From 9edf0dca54cdda5c7d78ec4353075b9c066ebeeb Mon Sep 17 00:00:00 2001 From: Fu Matthew Date: Wed, 16 Jan 2013 14:07:09 +0800 Subject: [PATCH] ika re-redesign module widget --- .../admin/default_widget_setting.css | 20 ++++++---- app/helpers/application_helper.rb | 10 ++++- .../_custom_widget_setting.html.erb | 31 +++++++++------ .../_default_widget_setting.html.erb | 9 ++++- .../_default_widget_style_panel.html.erb | 21 ++++++---- app/views/admin/page_parts/_edit.html.erb | 10 +++-- .../admin/page_parts/_module_widget.html.erb | 39 ++++++++++++------- .../_widget_data_source_category.html.erb | 4 +- .../_widget_data_source_tag.html.erb | 4 +- 9 files changed, 97 insertions(+), 51 deletions(-) diff --git a/app/assets/stylesheets/admin/default_widget_setting.css b/app/assets/stylesheets/admin/default_widget_setting.css index e68bb3aa..8bbe4a50 100644 --- a/app/assets/stylesheets/admin/default_widget_setting.css +++ b/app/assets/stylesheets/admin/default_widget_setting.css @@ -1,6 +1,11 @@ +label{ + white-space: nowrap !important; +} .style_switch{} -.style_switch ul{} +.style_switch ul{ + margin: 0; +} .style_switch li{ float: left; @@ -9,19 +14,18 @@ width: 103px; } .style_radio{ - margin: 0 0 5px 10px; + cursor: pointer; + margin: 0 0 0 10px; } .style_img{ display: block; - margin: 0 0 5px; + margin: 5px 0 5px -28px; } .style_description{ color: #6B6B6B; display: block; - margin: 0 0 0 5px; + font-size: 12px; + margin: 0 0 0 -25px; + white-space: normal; } - -label{ -    white-space: nowrap !important ; -} \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5c6cca95..980db7bc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,8 +54,14 @@ module ApplicationHelper raw(formatted_messages.join) end - def link_back - link_to t('back'), get_go_back, :class => 'nav' + def link_back(custom_class=nil) + case custom_class + when nil + link_to t('back'), get_go_back, :class => 'nav' + else + link_to t('back'), get_go_back, :class => custom_class + end + end # Clean the link back diff --git a/app/views/admin/page_parts/_custom_widget_setting.html.erb b/app/views/admin/page_parts/_custom_widget_setting.html.erb index a257336e..dea11a06 100644 --- a/app/views/admin/page_parts/_custom_widget_setting.html.erb +++ b/app/views/admin/page_parts/_custom_widget_setting.html.erb @@ -1,12 +1,21 @@ -
- - <% if @module_app.widgets[@widget_path].blank? %> - <%= t("default_widget.no_support_setting")%> - <%else%> - <%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %> - <% end %> +
+ +
+ <% if @module_app.widgets[@widget_path].blank? %> + <%= t("default_widget.no_support_setting")%> + <%else%> + <%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %> + <% end %> +
+
+ <% if(@module_app.widget_options && @module_app.widget_options.has_key?(@widget_path)) %> - - <%= render :partial=> "widget_ext_options" %> - <% end %> -
\ No newline at end of file +
+ +
+ <%= render :partial=> "widget_ext_options" %> +
+
+ <% end %> \ No newline at end of file diff --git a/app/views/admin/page_parts/_default_widget_setting.html.erb b/app/views/admin/page_parts/_default_widget_setting.html.erb index 728bf010..09d648eb 100644 --- a/app/views/admin/page_parts/_default_widget_setting.html.erb +++ b/app/views/admin/page_parts/_default_widget_setting.html.erb @@ -1,4 +1,8 @@ -
+
+ +
@@ -22,7 +26,7 @@ <%= select_tag "page_part[widget_field_type][]", widget_fiield_type_options(i), :include_blank => true %>
-
+

<% end %>
@@ -32,3 +36,4 @@ <%= text_field_tag :widget_data_count,@part.widget_data_count %>
+
\ No newline at end of file diff --git a/app/views/admin/page_parts/_default_widget_style_panel.html.erb b/app/views/admin/page_parts/_default_widget_style_panel.html.erb index 3a4096b4..df8ac8d8 100644 --- a/app/views/admin/page_parts/_default_widget_style_panel.html.erb +++ b/app/views/admin/page_parts/_default_widget_style_panel.html.erb @@ -1,45 +1,50 @@ -
- +
+ +
  • <%=image_tag 'module/default_widgets/style01.png'%> - <%= t("default_widget.caption.typeA") %> + <%= t("default_widget.caption.typeA") %> + +
  • <%=image_tag 'module/default_widgets/style02.png'%> <%= t("default_widget.caption.typeA") %> +
  • <%=image_tag 'module/default_widgets/style03.png'%> <%= t("default_widget.caption.typeB_style3") %> +
  • <%=image_tag 'module/default_widgets/style04.png'%> <%= t("default_widget.caption.typeB_style4") %> +
  • <%=image_tag 'module/default_widgets/style05.png'%> <%= t("default_widget.caption.typeC") %> +
+
\ No newline at end of file diff --git a/app/views/admin/page_parts/_edit.html.erb b/app/views/admin/page_parts/_edit.html.erb index c4bc7476..ac44a619 100644 --- a/app/views/admin/page_parts/_edit.html.erb +++ b/app/views/admin/page_parts/_edit.html.erb @@ -1,6 +1,6 @@ <%= stylesheet_link_tag "admin/default_widget_setting" %> -<%= form_for @part, :url => admin_page_part_path(@part) do |f| %> +<%= form_for @part, :url => admin_page_part_path(@part),:html=>{:class=>"clear form-horizontal edit_page_part"} do |f| %> <% LIST[:page_part_kinds].each do |kind| %> <%= f.radio_button :kind, kind, :class => 'part_kind' %> @@ -12,7 +12,9 @@
<% end %> -

- <%= f.submit t(:update_) %> <%= link_back %> -

+
+ <%= f.submit t(:update_),:class=>"btn btn-primary" %> + <%= link_back("btn") %> + +
<% end %> diff --git a/app/views/admin/page_parts/_module_widget.html.erb b/app/views/admin/page_parts/_module_widget.html.erb index 5cfcbbf0..18400c79 100644 --- a/app/views/admin/page_parts/_module_widget.html.erb +++ b/app/views/admin/page_parts/_module_widget.html.erb @@ -1,29 +1,40 @@
- <%= f.fields_for :title_translations do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> -

- <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}" %> - <%= f.text_field locale, :value => (@part.title_translations[locale] rescue nil),:size=>30 %> -

- <% end %> +
+ <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}",:class=>"control-label" %> +
+ <%= f.text_field locale, :value => (@part.title_translations[locale] rescue nil),:size=>30 %> +
+
<% end %> + <% end %>
-

- + +

+ +
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %> -

+
+
-

- +

+ +
<%= f.select :widget_path, @module_app.widgets.collect{|k,v| [k.humanize, k]}, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %> -

+
+
-
+
<%= render :partial => 'widget_data_source_category' %>
-
+
<%= render :partial => 'widget_data_source_tag' %>
diff --git a/app/views/admin/page_parts/_widget_data_source_category.html.erb b/app/views/admin/page_parts/_widget_data_source_category.html.erb index bd358cda..03ec505e 100644 --- a/app/views/admin/page_parts/_widget_data_source_category.html.erb +++ b/app/views/admin/page_parts/_widget_data_source_category.html.erb @@ -1,5 +1,6 @@ - + <% if @categories %> +
<%= nil_radio_button(@part,:category) %> <%= content_tag_for(:label, @categories,:class=>"radio inline") do |category|%> @@ -7,6 +8,7 @@ <%= category.title%> <% end %>
+
<% else %> <%= t("default_widget.no_support_setting")%> <% end %> \ No newline at end of file diff --git a/app/views/admin/page_parts/_widget_data_source_tag.html.erb b/app/views/admin/page_parts/_widget_data_source_tag.html.erb index 062cd1f5..ff2241e0 100644 --- a/app/views/admin/page_parts/_widget_data_source_tag.html.erb +++ b/app/views/admin/page_parts/_widget_data_source_tag.html.erb @@ -1,5 +1,6 @@ - + <% if @categories %> +
<%= nil_radio_button(@part,:tag) %> <%= content_tag_for(:label, @tags,:class=>"radio inline") do |tag|%> @@ -7,6 +8,7 @@ <%= tag[I18n.locale]%> <% end %>
+
<% else %> <%= t("default_widget.no_support_setting")%> <% end %> \ No newline at end of file