diff options
author | Martin Markech <martin.markech@matho.sk> | 2012-09-27 18:22:25 +0200 |
---|---|---|
committer | Martin Markech <martin.markech@matho.sk> | 2012-09-27 18:22:25 +0200 |
commit | 0a7c4e83e823e2a8d74c7ac352ae69bfbecfe434 (patch) | |
tree | 3c3bf7a5b0bea71ce7d476bb2a135d5a0c5771d4 /app/views | |
parent | 0a2c50a79f6e74674b8c6e167bb321a29d90bc58 (diff) | |
download | refinerycms-pc_banners-0a7c4e83e823e2a8d74c7ac352ae69bfbecfe434.tar.gz refinerycms-pc_banners-0a7c4e83e823e2a8d74c7ac352ae69bfbecfe434.tar.bz2 refinerycms-pc_banners-0a7c4e83e823e2a8d74c7ac352ae69bfbecfe434.zip |
add page tree + jquery tristate checkbox plugin
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/refinery/banners/admin/banners/_form.html.erb | 153 | ||||
-rw-r--r-- | app/views/refinery/banners/admin/banners/_page.html.erb | 19 |
2 files changed, 98 insertions, 74 deletions
diff --git a/app/views/refinery/banners/admin/banners/_form.html.erb b/app/views/refinery/banners/admin/banners/_form.html.erb index 1403fc4..b249f09 100644 --- a/app/views/refinery/banners/admin/banners/_form.html.erb +++ b/app/views/refinery/banners/admin/banners/_form.html.erb @@ -1,76 +1,81 @@ +<%- content_for(:javascripts) do -%> + <%= javascript_include_tag "banners/jquery.tristate.js", "banners/banners.js" -%> +<%- end -%> + <%= form_for [refinery, :banners_admin, @banner] do |f| -%> - <%= render '/refinery/admin/error_messages', - :object => @banner, - :include_object_name => true %> - - <%= hidden_field_tag 'banner[page_ids][]' %> - - <div class='field'> - <%= f.label :name -%> - <%= f.text_field :name, :class => 'larger widest' -%> - - </div> - - <div class='field'> - <%= f.label :title -%> - <%= f.text_field :title -%> - - </div> - - <div class='field'> - <%= f.label :description -%> - <%= f.text_field :description -%> - - </div> - - <div class='field'> - <%= f.label :image -%> - <%= render '/refinery/admin/image_picker', - :f => f, - :field => :image_id, - :image => @banner.image, - :toggle_image_display => false, - :description => t('refinery.banners.admin.banner') - %> - - </div> - - <div class='field'> - <%= f.label :url -%> - <%= f.text_field :url -%> - - </div> - - <div class='field'> - <%= f.label :is_active -%> - <%= f.check_box :is_active, :checked => @banner[:is_active] -%> - - </div> - - <div class='field'> - <%= f.label :start_date -%> - <%= f.date_select :start_date -%> - - </div> - - <div class='field'> - <%= f.label :expiry_date -%> - <%= f.date_select :expiry_date -%> - - </div> - - <div class="field"> - <%= f.label :pages %> - <% Refinery::Page.all.each do |page| %> - <div> - <%= check_box_tag "banner[page_ids][]", page.id, @banner.pages.include?(page) %> - <%= page.title %> - </div> - <% end %> - </div> - - <%= render '/refinery/admin/form_actions', :f => f, - :continue_editing => false, - :delete_title => t('delete', :scope => 'refinery.banners.admin.banners.banner'), - :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @banner.name) %> + <%= render '/refinery/admin/error_messages', + :object => @banner, + :include_object_name => true %> + + <%= hidden_field_tag 'banner[page_ids][]' %> + + <div class='field'> + <%= f.label :name -%> + <%= f.text_field :name, :class => 'larger widest' -%> + + </div> + + <div class='field'> + <%= f.label :title -%> + <%= f.text_field :title -%> + + </div> + + <div class='field'> + <%= f.label :description -%> + <%= f.text_field :description -%> + + </div> + + <div class='field'> + <%= f.label :image -%> + <%= render '/refinery/admin/image_picker', + :f => f, + :field => :image_id, + :image => @banner.image, + :toggle_image_display => false, + :description => t('refinery.banners.admin.banner') + %> + + </div> + + <div class='field'> + <%= f.label :url -%> + <%= f.text_field :url -%> + + </div> + + <div class='field'> + <%= f.label :is_active -%> + <%= f.check_box :is_active, :checked => @banner[:is_active] -%> + + </div> + + <div class='field'> + <%= f.label :start_date -%> + <%= f.date_select :start_date -%> + + </div> + + <div class='field'> + <%= f.label :expiry_date -%> + <%= f.date_select :expiry_date -%> + + </div> + + <section id="records" class="tree"> + <%= f.label :pages %> + <ul class="tristate"> + <%= render :partial => 'refinery/banners/admin/banners/page', :collection => Refinery::Page.order("lft ASC").select{|p| p.parent_id.nil?} %> + </ul> + </section> + + + <div style="clear: both;"></div> + <%= render '/refinery/admin/form_actions', :f => f, + :continue_editing => false, + :delete_title => t('delete', :scope => 'refinery.banners.admin.banners.banner'), + :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @banner.name) %> <% end -%> + + diff --git a/app/views/refinery/banners/admin/banners/_page.html.erb b/app/views/refinery/banners/admin/banners/_page.html.erb new file mode 100644 index 0000000..640d378 --- /dev/null +++ b/app/views/refinery/banners/admin/banners/_page.html.erb @@ -0,0 +1,19 @@ +<li class='clearfix record icons' id="<%= dom_id(page) -%>" > + + <% if page.children.present? %> + <span class="icon toggle expanded" title="<%= t('expand_collapse', :scope => 'refinery.admin.pages') %>"></span> + <% else %> + <span class="icon"></span> + <% end %> + + <%= check_box_tag "banner[page_ids][]", page.id, @banner.pages.include?(page) %> + + <span class='title <%= 'toggle' if page.children.present? %>'> + <%= page.title %> + </span> + + + <ul class='nested' > + <%= render(:partial => 'refinery/banners/admin/banners/page', :collection => page.children) %> + </ul> +</li> |