| @@ -37,6 +37,7 @@ gem 'flatstrap-rails' | ||
| 37 | 37 | gem 'font-awesome-rails' | 
| 38 | 38 | gem 'bootstrap-timepicker-rails' | 
| 39 | 39 | gem "bootstrap-switch-rails" | 
| 40 | +gem 'jasny_bootstrap_extension_rails' | |
| 40 | 41 | gem 'simple_form' | 
| 41 | 42 | gem 'bootstrap_form' | 
| 42 | 43 | gem 'friendly_id', '~> 5.0.0' | 
| @@ -91,6 +91,7 @@ GEM | ||
| 91 | 91 | i18n (0.6.11) | 
| 92 | 92 | inflecto (0.0.2) | 
| 93 | 93 | ipaddress (0.8.0) | 
| 94 | + jasny_bootstrap_extension_rails (0.0.1) | |
| 94 | 95 | jbuilder (1.5.3) | 
| 95 | 96 | activesupport (>= 3.0.0) | 
| 96 | 97 | multi_json (>= 1.2.0) | 
| @@ -209,6 +210,7 @@ DEPENDENCIES | ||
| 209 | 210 | font-awesome-rails | 
| 210 | 211 | friendly_id (~> 5.0.0) | 
| 211 | 212 | i18n | 
| 213 | + jasny_bootstrap_extension_rails | |
| 212 | 214 | jbuilder (~> 1.2) | 
| 213 | 215 | jquery-rails | 
| 214 | 216 | less-rails | 
| @@ -14,6 +14,7 @@ | ||
| 14 | 14 | //= require jquery_ujs | 
| 15 | 15 | //= require twitter/bootstrap | 
| 16 | 16 | //= require bootstrap-switch | 
| 17 | +//= require jasny-bootstrap | |
| 17 | 18 | //= require summernote | 
| 18 | 19 | //= require turbolinks | 
| 19 | 20 | //= require_tree . | 
| @@ -2,6 +2,8 @@ | ||
| 2 | 2 |  | 
| 3 | 3 | attachRatingHandler = -> | 
| 4 | 4 |  | 
| 5 | +  $(".bootstrap_switch").bootstrapSwitch('size', 'large'); | |
| 6 | + | |
| 5 | 7 | # to set summernote object | 
| 6 | 8 | # You should change '#post_content' to your textarea input id | 
| 7 | 9 |    summer_note = $('#post_content') | 
| @@ -13,6 +13,8 @@ | ||
| 13 | 13 | *= require font-awesome | 
| 14 | 14 | *= require rails_bootstrap_forms | 
| 15 | 15 | *= require bootstrap3-switch | 
| 16 | + *= require jasny-bootstrap | |
| 17 | + *= require jasny-bootstrap-responsive | |
| 16 | 18 | *= require summernote | 
| 17 | 19 | *= require_tree . | 
| 18 | 20 | */ | 
| @@ -79,4 +79,9 @@ | ||
| 79 | 79 | background-color: #f5f5f5; | 
| 80 | 80 | border: 1px solid #e3e3e3; | 
| 81 | 81 | margin-left: 28px; | 
| 82 | +} | |
| 83 | + | |
| 84 | + | |
| 85 | +.form-bordered { | |
| 86 | + margin-bottom: 0px; | |
| 82 | 87 | } | 
| @@ -18,6 +18,7 @@ class BlogPostsController < ApplicationController | ||
| 18 | 18 | # GET /blog_posts/new | 
| 19 | 19 | def new | 
| 20 | 20 | @blog_post = BlogPost.new | 
| 21 | + @blog_post.published = true | |
| 21 | 22 | end | 
| 22 | 23 |  | 
| 23 | 24 | # GET /blog_posts/1/edit | 
| @@ -1,27 +1,46 @@ | ||
| 1 | -<%= bootstrap_form_for(@blog_post) do |f| %> | |
| 1 | +<div class="media thumbnail" style="padding: 0px"> | |
| 2 | +<%= bootstrap_form_for(@blog_post, html: {style: 'margin-bottom: 0px;', class: 'form-bordered'}) do |f| %> | |
| 2 | 3 | <%= f.alert_message "Please fix the errors below."%> | 
| 3 | 4 |  | 
| 4 | -<div class="controls controls-row"> | |
| 5 | - <%= f.form_group :title, class: "span4", style: 'margin-left: 0px;' do %> | |
| 6 | - <%= f.text_field :title, class: 'input-block-level' %> | |
| 7 | - <% end %> | |
| 8 | - <%= f.form_group :slug, class: "span3" do %> | |
| 9 | - <%= f.text_field :slug, class: 'input-block-level' %> | |
| 10 | - <% end %> | |
| 11 | - <%= f.form_group :description, class: "span5" do %> | |
| 12 | - <%= f.text_field :description, class: 'input-block-level' %> | |
| 13 | - <% end %> | |
| 14 | -</div> | |
| 5 | + <div style="padding: 10px;"> | |
| 6 | + <div class="controls controls-row"> | |
| 7 | + <%= f.form_group :title, class: "span5", style: 'margin-left: 0px;' do %> | |
| 8 | + <%= f.text_field :title, label: (t 'blog.title'), class: 'input-block-level', required: true %> | |
| 9 | + <% end %> | |
| 10 | + <%= f.form_group :slug, class: "span4" do %> | |
| 11 | + <%= f.text_field :slug, label: (t 'blog.slug'), class: 'input-block-level', required: true %> | |
| 12 | + <% end %> | |
| 15 | 13 |  | 
| 14 | + <div class="span2"> | |
| 15 | + <div class="fileupload fileupload-new" data-provides="fileupload" style="margin-top: 5px;"> | |
| 16 | + <div class="fileupload-preview thumbnail" style="width: 230px; height: 145px;"><%= image_tag @blog_post.image.to_s if @blog_post.image? %></div> | |
| 17 | + </div> | |
| 18 | + <span class="btn btn-default btn-file btn-mini"> | |
| 19 | + <span class="fileinput-new"></span> | |
| 20 | + <span class="fileinput-exists"></span> | |
| 21 | + <%= f.file_field :image, class: 'hidden', label: (t 'blog.select_image') %> | |
| 22 | + </span> | |
| 23 | + </div> | |
| 24 | + | |
| 25 | + </div> | |
| 16 | 26 |  | 
| 17 | - <div class="form-inputs"> | |
| 18 | - | |
| 19 | - <%= f.file_field :image %> | |
| 20 | - <%= f.text_area :content, class: 'summernote', id: 'post_content' %> | |
| 21 | - <%= f.check_box :published %> | |
| 27 | + <%= f.form_group :description, class: "span9", style: 'margin-left: 0px; margin-top: -130px;' do %> | |
| 28 | + <%= f.text_field :description, label: (t 'blog.description'), class: 'input-block-level', required: true %> | |
| 29 | + <% end %> | |
| 30 | + | |
| 31 | + <%= f.form_group :published, class: "span9 bootstrap_switch_group", style: 'margin-left: 0px; margin-top: -50px;' do %> | |
| 32 | +				<%= f.check_box :published, class: 'bootstrap_switch', label: (t 'blog.visibility'),data: { on_text: (t 'blog.publish'), off_text: (t 'blog.unpublish') } %> | |
| 33 | + <% end %> | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + <%= f.text_area :content, label: (t 'blog.content'), class: 'summernote', id: 'post_content', hide_label: :true %> | |
| 22 | 38 | </div> | 
| 39 | + <div class="form-actions" style="margin: 0px;"> | |
| 40 | + <%= f.submit (t 'blog.submit'), class: 'btn btn-success' %> | |
| 41 | + <%= link_to 'Show', @blog_post, class: 'btn' if action_name == 'edit' %> | |
| 42 | + <%= link_to (t 'blog.back'), admin_posts_path, class: 'btn btn-link' %> | |
| 43 | + </div> | |
| 23 | 44 |  | 
| 24 | - <div class="form-actions"> | |
| 25 | - <%= f.submit %> | |
| 26 | - </div> | |
| 27 | -<% end %> | |
| 45 | + <% end %> | |
| 46 | +</div> | 
| @@ -1,6 +1,5 @@ | ||
| 1 | -<h1>Editing blog_post</h1> | |
| 1 | +<div class="page-header"> | |
| 2 | + <h1><%= t "blog.edit_post" %></h1> | |
| 3 | +</div> | |
| 2 | 4 |  | 
| 3 | -<%= render 'form' %> | |
| 4 | - | |
| 5 | -<%= link_to 'Show', @blog_post %> | | |
| 6 | -<%= link_to 'Back', blog_posts_path %> | |
| 5 | +<%= render 'form' %> | 
| @@ -1,5 +1,5 @@ | ||
| 1 | -<h1>New blog_post</h1> | |
| 1 | +<div class="page-header"> | |
| 2 | + <h1><%= t "blog.new_post" %></h1> | |
| 3 | +</div> | |
| 2 | 4 |  | 
| 3 | 5 | <%= render 'form' %> | 
| 4 | - | |
| 5 | -<%= link_to 'Back', blog_path %> | 
| @@ -239,6 +239,18 @@ en: | ||
| 239 | 239 | blog: | 
| 240 | 240 | by: By | 
| 241 | 241 | ago: ago | 
| 242 | + publish: Public | |
| 243 | + unpublish: Private | |
| 244 | + visibility: Visibility | |
| 245 | + new_post: New Post | |
| 246 | + edit_post: Edit Post | |
| 247 | + title: Title | |
| 248 | + slug: Slug | |
| 249 | + select_image: Select Image | |
| 250 | + description: Description | |
| 251 | + content: Content | |
| 252 | + submit: Save | |
| 253 | + back: Back | |
| 242 | 254 | contact: | 
| 243 | 255 | contact: Contact | 
| 244 | 256 | contact_messages: Contact Messages | 
| @@ -241,6 +241,18 @@ pt-BR: | ||
| 241 | 241 | blog: | 
| 242 | 242 | by: Por | 
| 243 | 243 | ago: atras | 
| 244 | + publish: Publico | |
| 245 | + unpublish: Privado | |
| 246 | + visibility: Visibilidade | |
| 247 | + new_post: Novo Artigo | |
| 248 | + edit_post: Editar Artigo | |
| 249 | + title: Título | |
| 250 | + slug: Slug | |
| 251 | + select_image: Selecionar Imagem | |
| 252 | + description: Descrição | |
| 253 | + content: Conteúdo | |
| 254 | + submit: Salvar | |
| 255 | + back: Voltar | |
| 244 | 256 | contact: | 
| 245 | 257 | contact: Contato | 
| 246 | 258 | contact_messages: Mensagens de Contato |