Skip to content

Commit

Permalink
Add bootstrap, jquery-ui and convert Element.toggle to bootstrap coll…
Browse files Browse the repository at this point in the history
…apse
  • Loading branch information
Thomas Lecavelier committed Oct 16, 2013
1 parent 142a21d commit 929afe2
Show file tree
Hide file tree
Showing 10 changed files with 18,532 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/helpers/admin/content_helper.rb
Expand Up @@ -62,7 +62,7 @@ def get_post_types
end

def toggle_element(element, label=_("Change"))
"<a href=\"#\" onclick=\"Element.toggle('#{element}'); return false\">#{label}</a>".html_safe
link_to(label, "##{element}", :"data-toggle" => :collapse, :"data-target" => "##{element}")
end

def publish_now_or_already_published(article)
Expand Down
68 changes: 57 additions & 11 deletions app/views/admin/content/_form.html.erb
Expand Up @@ -50,21 +50,21 @@
<legend><%= t(".publish_settings") %></legend>
<div class='control-group'>
<p><%= t(".status") %>: <strong><%= _(@article.state.to_s.downcase) %></strong>
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.change')%></a>
<a href="#" class="extoggle status"><%= t('.change')%></a>
</p>
<div id='status' style='display: none;'>
<label for="article_published" class='checkbox'>
<%= check_box 'article', 'published' %>
<%= t(".published") %>
</label>
<p><span class='btn btn-mini'>
<a href="#" onclick="Element.toggle('status'); return false">OK</a>
<a href="#" class="extoggle status">OK</a>
</span></p>
</div>
</div>
<div class='control-group'>
<p><%= t(".allowed_comments_and_trackbacks", allow_comment: content_tag(:strong, get_feedback_status(@article.allow_comments)), allow_trackback: content_tag(:strong, get_feedback_status(@article.allow_pings))) %>
<a href="#" onclick="Element.toggle('conversation'); return false"><%= t('.change')%></a>
<a href="#" class="extoggle conversation" ><%= t('.change')%></a>
<div id='conversation' style='display: none'>
<label for="article_allow_pings" class='checkbox'>
<%= check_box 'article', 'allow_pings' %>
Expand All @@ -75,48 +75,94 @@
<%= t(".allow_comments") %>
</label>
<p><span class='btn btn-mini'>
<a href="#" onclick="Element.toggle('conversation'); return false"><%= t('.ok')%></a>
<a href="#" class="extoggle conversation"><%= t('.ok')%></a>
</span></p>
</div>
</div>
<div class='control-group'>
<p><%= t(".published") %> <strong><%= publish_now_or_already_published @article %></strong>
<a href="#" onclick="Element.toggle('publish'); return false"><%= t('.change')%></a>
<a href="#" class="extoggle publish" ><%= t('.change')%></a>
</p>
<div id='publish' class='input-append' style='display: none;'>
<%= calendar_date_select 'article', 'published_at' %>
<p><span class="btn btn-mini">
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.ok')%></a>
<a href="#" class="extoggle status"><%= t('.ok')%></a>
</span></p>
</div>

</div>
<div class='control-group'>
<p><%= t(".visibility") %>: <strong><%= @article.password.nil? || @article.password.empty? ? t(".public") : t(".protected") %></strong>
<a href="#" onclick="Element.toggle('visibility'); return false"><%= t('.change')%></a>
<a href="#" class="extoggle visibility" ><%= t('.change')%></a>
</p>
<div id='visibility' style='display: none'>
<label for="article_password"><%= t(".password") %>
<div class='separator'>
<h4><%= _("Excerpt") %></h4>
<%= text_area 'article', 'excerpt', {:height => '150', :class => 'input-block-level', :rows => '5'} %>
<span class='help-block'><%=_("Excerpts are post summaries that show only on your blog homepage and won’t appear on the post itself") %></span>
</div>

<div class='well'>
<fieldset>
<legend><%= _("Publish settings") %></legend>
<div class='control-group'>
<p><%= _("Status") %>: <strong><%= _(@article.state.to_s.downcase) %></strong> <%= toggle_element 'status' %></p>
<div id='status' class="collapse">
<label for="article_published" class='checkbox'>
<%= check_box 'article', 'published' %>
<%= _("Published") %>
</label>
<%= ok_button('status') %>
</div>
</div>
<div class='control-group'>
<p><%= _("Comments are %s and trackbacks are %s", content_tag(:strong, get_feedback_status(@article.allow_comments)), content_tag(:strong, get_feedback_status(@article.allow_pings))) %>
<%= toggle_element 'conversation' %></p>
<div id='conversation' class="collapse">
<label for="article_allow_pings" class='checkbox'>
<%= check_box 'article', 'allow_pings' %>
<%= _("Allow trackbacks") %>
</label>
<label for="article_allow_comments" class='checkbox'>
<%= check_box 'article', 'allow_comments' %>
<%= _("Allow comments") %>
</label>
<p><span class='btn btn-mini'><%= toggle_element 'conversation', "OK" %></span></p>
</div>
</div>
<div class='control-group'>
<p><%= _("Published") %> <strong><%= publish_now_or_already_published @article %></strong> <%= toggle_element 'publish' %></p>
<div id='publish' class='collapse input-append'>
<%= text_field 'article', 'published_at', :class => 'datepicker' %>
<%= ok_button('publish') %>
</div>

</div>
<div class='control-group'>
<p><%= _("Visibility") %>: <strong><%= @article.password.nil? || @article.password.empty? ? _("public") : _("protected") %></strong> <%= toggle_element 'visibility' %></p>
<div id='visibility' class="collapse">
<label for="article_password"><%= _("Password:") %>
<%= password_field :article, :password, :class => 'span10' %>
</label>
<p><span class="btn btn-mini">
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.ok')%></a>
<a href="#" class="extoggle status"><%= t('.ok')%></a>
</span></p>
</div>
</div>
<div class='control-group'>
<%= t(".permalink") %>:
<a href="#" onclick="Element.toggle('permalink'); return false"><%= t('.change')%></a>
<a href="#" class="extoggle permalink"><%= t('.change')%></a>
<div class='inputs-list' id='permalink' style='display: none'>
<%= text_field 'article', 'permalink', {class: 'span10'} %>
<p><span class="btn btn-mini">
<a href="#" onclick="Element.toggle('status'); return false"><%= t('.ok')%></a>
<a href="#" class="extoggle status"><%= t('.ok')%></a>
</span></p>
</div>
</div>
<div class='control-group'>
<%= t(".article_filter") %>: <strong id='text_filter_placeholder'><%= _("#{@article.text_filter.description}") %></strong>
<a href="#" onclick="Element.toggle('text_filter'); return false"><%= t('.change')%></a>
<a href="#" class="extoggle text_filter"><%= t('.change')%></a>

<div id='text_filter' style='display: none'>
<select name="article[text_filter]" id="article_text_filter">
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/shared/_macros.html.erb
@@ -1,5 +1,5 @@
<div>
<i class='icon icon-question-sign'></i> <%= link_to_function(_("Show help on Publify macros") + " (+/-)", update_page { |page| page.visual_effect(:toggle_blind, "macros", :duration => 0.2) }) %>
<i class='icon icon-question-sign'></i> <%= link_to(_("Show help on Publify macros") + " (+/-)", :remote => true) %>
<table class='table table-striped' id='macros' style='display: none'>
<thead>
<tr>
Expand Down
5 changes: 2 additions & 3 deletions app/views/layouts/administration.html.erb
Expand Up @@ -6,9 +6,8 @@
<title><%= this_blog.blog_name %><%= controller.controller_name %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="imagetoolbar" content="no" />
<%= stylesheet_link_tag "growler", "bootstrap", "administration_structure", "lightbox" %>
<%= javascript_include_tag "prototype", "effects", "builder", "dragdrop", "controls", "publify", "lightbox", "growler", "publify_carousel", "administration" %>
<%= calendar_date_select_includes %>
<%= stylesheet_link_tag "growler", "bootstrap", "administration_structure", "lightbox", "jquery-ui" %>
<%= javascript_include_tag "jquery", "jquery_ujs", "jquery-ui", "bootstrap", "publify", "publify_jquery", "lightbox", "growler", "publify_carousel", "administration" %>
<style type="text/css">
#carousel-content .slide { width: <%= this_blog.image_thumb_size %>; }
@font-face {
Expand Down
1 change: 0 additions & 1 deletion config/application.rb
Expand Up @@ -43,7 +43,6 @@ class Application < Rails::Application
require 'publify_sidebar'
require 'publify_textfilters'
require 'publify_avatar_gravatar'
require 'calendar_date_select/lib/calendar_date_select.rb'
require 'action_web_service'
## Required by the plugins themselves.
# require 'avatar_plugin'
Expand Down

0 comments on commit 929afe2

Please sign in to comment.