apply view

This commit is contained in:
Fu Matthew 2013-01-10 18:00:58 +08:00
parent 08adb887c5
commit ca51ebc08c
17 changed files with 172 additions and 45 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -21,7 +21,32 @@ module Admin::PagePartsHelper
options_for_select(options, (local_item[:widget_field][i][1] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
end
def tag_checked_value(part,radio_value)
part and (part[:tag] == radio_value) ? true : false
end
def category_checked_value(part,radio_value)
part and (part[:tag] == radio_value) ? true : false
end
def style_checked_value(part,radio_value)
part and (part.widget_style == radio_value) ? true : false
end
def nil_radio_button(part,tag_or_cate)
content_tag :label,:class=>"radio inline" do
op = radio_button("page_part", tag_or_cate, nil, :checked => eval("#{tag_or_cate}_checked_value(part,nil)"))
op << I18n.t("default_widget.no_value")
end
end
def show_default_widget_setting_panel
binding.pry
false
end
def show_custom_widget_setting_panel
end
end

View File

@ -0,0 +1,18 @@
<span id="widget_field">
<label for="widget_field"><%= t "default_widget.fields_order" %></label>
<% @module_app.widget_fields.each_with_index do |widget_field, i| %>
<%= i+1 %>
<%= select_tag "page_part[widget_field][]", widget_field_options(i), :include_blank => true %>
<%= select_tag "page_part[widget_field_type][]", widget_fiield_type_options(i), :include_blank => true %> <br />
<% end %>
<br/><br/>
<%= label_tag t("default_widget.widget_data_count") %>
<%= text_field_tag :widget_data_count,@part.widget_data_count %>
<br>
</span>

View File

@ -0,0 +1,45 @@
<label><%= t("default_widget.select_widget_style") %></label>
<div class="style_switch well">
<ul class="clear">
<li>
<label class="radio style_radio">
<%= f.radio_button :widget_style,"typeA",:checked => style_checked_value(@part,"typeA") %>
1
</label>
<span class="style_img"><%=image_tag 'module/default_widgets/style01.png'%></span>
<span class="style_description"><%= t("default_widget.caption.typeA") %></span>
</li>
<li>
<label class="radio style_radio">
<%= f.radio_button :widget_style,"typeB_style2",:checked => style_checked_value(@part,"typeB_style2") %>
2
</label>
<span class="style_img"><%=image_tag 'module/default_widgets/style02.png'%></span>
<span class="style_description"><%= t("default_widget.caption.typeA") %></span>
</li>
<li>
<label class="radio style_radio">
<%= f.radio_button :widget_style,"typeB_style3",:checked => style_checked_value(@part,"typeB_style3") %>
3
</label>
<span class="style_img"><%=image_tag 'module/default_widgets/style03.png'%></span>
<span class="style_description"><%= t("default_widget.caption.typeB_style3") %></span>
</li>
<li>
<label class="radio style_radio">
<%= f.radio_button :widget_style,"typeB_style4",:checked => style_checked_value(@part,"typeB_style4") %>
4
</label>
<span class="style_img"><%=image_tag 'module/default_widgets/style04.png'%></span>
<span class="style_description"><%= t("default_widget.caption.typeB_style4") %></span>
</li>
<li>
<label class="radio style_radio">
<%= f.radio_button :widget_style,"typeC",:checked => style_checked_value(@part,"typeC") %>
5
</label>
<span class="style_img"><%=image_tag 'module/default_widgets/style05.png'%></span>
<span class="style_description"><%= t("default_widget.caption.typeC") %></span>
</li>
</ul>
</div>

View File

@ -1,51 +1,41 @@
<div>
<div style="display:block" class="part_kind_partial" id="part_module_widget">
<div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<p>
<%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}" %>
<%= f.text_field locale, :value => (@part.title_translations[locale] rescue nil) %>
<%= f.text_field locale, :value => (@part.title_translations[locale] rescue nil),:size=>30 %>
</p>
<% end %>
<% end %>
</div>
<% end %>
</div>
<span id='module_app_list'>
<p id="module_app_list">
<label for="age_part[module_app]"><%= t "default_widget.select_module_app" %></label>
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %>
</span>
</p>
<span id='widget_list'>
<%#= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
<p id="widget_list">
<label for="age_part[widget_path]"><%= t "default_widget.select_widget_path" %></label>
<%= f.select :widget_path, @module_app.widgets.collect{|k,v| [k.humanize, k]}, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %>
</span>
</p>
<span id='widget_style_list'>
<%#= f.select :widget_style, @widget_style, :selected => @part.widget_style %>
<%= select('page_part','widget_style', @widget_style, :selected => @part[:widget_style], :include_blank => true ) rescue ''%>
</span>
<div id="widget_option">
<div id="widget_data_source_category" class="well">
<%= render :partial => 'widget_data_source_category' %>
</div>
<div id="widget_data_source_tag" class="well">
<%= render :partial => 'widget_data_source_tag' %>
</div>
:
<span id="widget_category">
<%= render 'widget_categories' %>
</span>
<%= t :or_lower %>
<span id="widget_tag">
<%= render 'widget_tags' %>
</span>
</div>
<span id='widget_field'>
<div id="widget_setting">
<%= render :partial => 'widget_setting' %>
</div>
<!-- <span id="widget_options">
<%= render 'widget_fields' %>
</span> -->
<%#= f.label :widget_field %>
<%# @module_app.widget_fields.each_with_index do |widget_field, i| %>
<%#= i+1 %>
<%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, (@part.widget_field ? @part.widget_field[i] : nil) ), :include_blank => true %> <br />
<%# end %>
<%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %>
</span>
<span id="widget_options">
<%= render 'widget_options' %>
</span>
</div>

View File

@ -0,0 +1,12 @@
<label><%= t "default_widget.data_source.tag" %></label>
<% if @categories %>
<fieldset>
<%= nil_radio_button(@part,:category) %>
<%= content_tag_for(:label, @categories,:class=>"radio inline") do |category|%>
<%= radio_button("page_part", "category", category.id, :checked => category_checked_value(@part,category.id) )%>
<%= category.title%>
<% end %>
</fieldset>
<% else %>
<%= t("default_widget.no_support_setting")%>
<% end %>

View File

@ -0,0 +1,12 @@
<label><%= t "default_widget.data_source.category" %></label>
<% if @categories %>
<fieldset>
<%= nil_radio_button(@part,:tag) %>
<%= content_tag_for(:label, @tags,:class=>"radio inline") do |tag|%>
<%= radio_button("page_part", "tag", tag.id, :checked => tag_checked_value(@part,tag.id) )%>
<%= tag[I18n.locale]%>
<% end %>
</fieldset>
<% else %>
<%= t("default_widget.no_support_setting")%>
<% end %>

View File

@ -0,0 +1,7 @@
<% if show_default_widget_setting_panel %>
<div id="default_widget">
<%= render :partial => 'default_widget_style_panel',:locals=>{:f=>f} %>
<%= render :partial => 'default_widget_setting' %>
</div>
<% elsif show_custom_widget_setting_panel %>
<% end %>

View File

@ -150,6 +150,23 @@ zh_tw:
deadline: 最後期限
default: Default
default_css: 預設樣式表
default_widget:
no_support_setting: 沒有可以使用的設定
no_value: 不設定(全部)
fields_order: 輸出欄位順序
select_module_app: 外掛模組選擇
select_widget_path: 外掛樣版選擇
select_widget_style: 排版樣式
widget_data_count: 模組輸出則數
caption:
typeA: 表格式排版,簡單明瞭呈現內容
typeB_style2: 一圖一文式,輸出欄位水平排列
typeB_style3: 一圖一文式,輸出欄位垂直排列,圖片在左方
typeB_style4: 一圖一文式,輸出欄位垂直排列,圖片在右方
typeC: 一圖多文式,輸出欄位垂直排列
data_source:
category: 資料來源:類別
tag: 資料來源:標籤
delete:
file: 刪除檔案
success:
@ -407,3 +424,4 @@ zh_tw:
visitors_this_year: 今年造訪人次
visitors_today: 今日造訪人次
yes_: "是"