Compare commits

...

2 Commits

Author SHA1 Message Date
Harry Bomrah 5032a30f3e removed faq from built in extensions 2014-02-13 12:02:36 +08:00
Harry Bomrah 7e3844c45c new type frontend for faq 2014-02-12 19:37:40 +08:00
4 changed files with 103 additions and 1 deletions

View File

@ -58,6 +58,7 @@ class DefaultWidgetController< OrbitWidgetController
@frontend_field_names = @page_part.frontend_field_name
@frontend_classes = @page_part.frontend_class
@frontend_sat_to_links = @page_part.frontend_sat_to_link
@widget_title = @page_part.title_translations[I18n.locale.to_s]
@data_limit = @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
@paginate = true
@ -95,6 +96,9 @@ class DefaultWidgetController< OrbitWidgetController
when "typeC"
@tag_class = 'default_widget_typeC'
@partial = "typeC"
when "typeD"
@tag_class = 'default_widget_typeC'
@partial = "typeD"
end
end
end

View File

@ -35,6 +35,13 @@
<span class="style_description"><%= t("default_widget.caption.typeC") %></span>
</li>
<% end %>
<% if @enabled_styles.include?("typeD") %>
<li>
<%= radio_button_tag "page[frontend_style]", "typeD", @checked_style ? @checked_style.eql?("typeD") : false, class: "d-theme" %>
<%= image_tag 'module/default_widgets/style05.png'%>
<span class="style_description"><%= t("default_widget.caption.typeD") %></span>
</li>
<% end %>
</ul>
<label><%= t("default_widget.fields_") %></label>
<table>

View File

@ -0,0 +1,91 @@
<div class="typeD" id="typeD2">
<% @data.each do |row_data| %>
<div class="typeD-group">
<div class="typeD-heading">
<% @frontend_field_names.each_with_index do |field,index| %>
<% if index == 0 %>
<span class="category">
<%= link_to_field(row_data,field, @frontend_sat_to_links[index],{orig_page: @page_id.to_s}) unless field.blank? %>
</span>
<% else %>
<a href="<%= row_data.id.to_s %>" class="typeD-toggle"> <%= row_data.title %> </a>
<% end %>
<% end %>
</div>
<div data-jump="<%= row_data.id.to_s %>" class="typeD-body" style="display:none;">
<div class="typeD-inner">
<%= row_data.answer.html_safe %>
</div>
</div>
</div>
<% end %>
</div>
<script type="text/javascript">
$("#typeD2 a.typeD-toggle").click(function(){
collapse($(this).attr("href"));
return false;
})
var collapse = function(answer){
var element_to_hide = $("div[data-jump=" + answer + "]");
$("#typeD2 div.typeD-body").slideUp();
$('.typeD-heading').removeClass("in");
if(!element_to_hide.hasClass("in")){
$("#typeD2 div.typeD-body").removeClass("in");
element_to_hide.addClass("in").siblings('.typeD-heading').addClass("in");
element_to_hide.slideDown();
window.location.hash = answer;
}else{
element_to_hide.removeClass("in");
}
}
if(window.location.hash)
collapse(window.location.hash.replace("#",""));
</script>
<style type="text/css">
.typeD .typeD-group {
margin-bottom: 0.5em;
}
.typeD .typeD-group .typeD-heading {
line-height: 3em;
padding: 0.5em 0.8em;
background-color: #efefef;
border-radius: 0.3em;
border-bottom: none;
}
.typeD .typeD-group .typeD-heading.in {
border-radius: 0.3em 0.3em 0 0;
border-bottom: 1px solid #d9cbc4;
}
.typeD .typeD-group .typeD-heading .category {
padding-right: 0.5em;
margin-right: 0.5em;
font-size: 1.2em;
display: inline-block;
font-weight: 700;
border-right: 1px solid #d1d1d1;
}
.typeD .typeD-group .typeD-heading .category a {
color: #3596E4;
}
.typeD .typeD-group .typeD-toggle {
font-size: 1.4em;
font-weight: 800;
color: #878787;
}
.typeD .typeD-group .typeD-body {
padding: 1em;
border-color: #efefef;
border-style: solid;
border-width: 0 1px 1px;
border-radius: 0 0 0.3em 0.3em;
}
.typeD .typeD-group .typeD-inner {
line-height: 1.2em;
font-size: 1.2em;
}
.typeD .typeD-group .typeD-toggle:hover {
color: #0f5387;
}
</style>

View File

@ -14,4 +14,4 @@ gem 'personal_lab', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-per
gem 'personal_patent', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-personalpatent.git'
gem 'personal_project', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-personalproject.git'
gem 'personal_research', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-personalresearch.git'
gem 'web_resource', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-webresource.git'
gem 'web_resource', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-webresource.git'