Compare commits

...

2 Commits

Author SHA1 Message Date
邱博亞 681bbbec87 Prepare to support ruby 3.3. 2024-02-24 20:58:47 +08:00
邱博亞 55c8d3d3da Add widget7 template. (including title, description) 2024-02-24 20:58:25 +08:00
3 changed files with 108 additions and 46 deletions

View File

@ -1,56 +1,58 @@
module WebResource
class Engine < ::Rails::Engine
initializer "web_resource" do
OrbitApp.registration "WebResource", :type => "ModuleApp" do
module_label "web_resource.web_resource"
base_url File.expand_path File.dirname(__FILE__)
initializer "web_resource" do
Rails.application.config.to_prepare do
OrbitApp.registration "WebResource", :type => "ModuleApp" do
module_label "web_resource.web_resource"
base_url File.expand_path File.dirname(__FILE__)
taggable "WebLink"
widget_methods ["widget"]
widget_settings [{"data_count"=>30}]
models_to_cache [:web_link]
categorizable
authorizable
frontend_enabled
data_count 1..30
side_bar do
head_label_i18n 'web_resource',:icon_class=>"icons-link"
available_for "users"
active_for_controllers (['admin/web_resources'])
head_link_path "admin_web_resources_path"
taggable "WebLink"
widget_methods ["widget"]
widget_settings [{"data_count"=>30}]
models_to_cache [:web_link]
categorizable
authorizable
frontend_enabled
data_count 1..30
side_bar do
head_label_i18n 'web_resource',:icon_class=>"icons-link"
available_for "users"
active_for_controllers (['admin/web_resources'])
head_link_path "admin_web_resources_path"
context_link 'list_',
:link_path=>"admin_web_resources_path" ,
:priority=>1,
:active_for_action=>{'admin/web_resources'=>'index'},
:available_for => 'users'
context_link 'new_',
:link_path=>"new_admin_web_resource_path" ,
:priority=>2,
:active_for_action=>{'admin/web_resources'=>'new'},
:available_for => 'sub_managers'
context_link 'list_',
:link_path=>"admin_web_resources_path" ,
:priority=>1,
:active_for_action=>{'admin/web_resources'=>'index'},
:available_for => 'users'
context_link 'new_',
:link_path=>"new_admin_web_resource_path" ,
:priority=>2,
:active_for_action=>{'admin/web_resources'=>'new'},
:available_for => 'sub_managers'
context_link 'web_link.order',
:link_path=>"admin_web_resources_order_path" ,
:priority=>2,
:active_for_action=>{'admin/web_resources'=>'order'},
:available_for => 'managers'
context_link 'web_link.order',
:link_path=>"admin_web_resources_order_path" ,
:priority=>2,
:active_for_action=>{'admin/web_resources'=>'order'},
:available_for => 'managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'web_resource').id}",
:priority=>3,
:active_for_action=>{'admin/web_resources.'=>'categories'},
:active_for_category => 'WebResource',
:available_for => 'managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'web_resource').id}",
:priority=>3,
:active_for_action=>{'admin/web_resources.'=>'categories'},
:active_for_category => 'WebResource',
:available_for => 'managers'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'web_resource').id}",
:priority=>4,
:active_for_action=>{'admin/web_resources'=>'tags'},
:active_for_tag => 'WebResource',
:available_for => 'managers'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'web_resource').id}",
:priority=>4,
:active_for_action=>{'admin/web_resources'=>'tags'},
:active_for_tag => 'WebResource',
:available_for => 'managers'
end
end
end
end

View File

@ -0,0 +1,52 @@
<div class="widget-link widget4 widget-7">
<div class="widget-link__more-wrap clearfix">
<h2 class="widget-link__widget-title">
<span>{{widget-title}}</span>
</h2>
</div>
<div class="widget-link_wrapper">
<div class="cycle-slideshow widget-content" style="margin: 0em 3em;"
data-level="0" data-list="web_link" data-cycle-slides="> li"
data-cycle-fx="carousel" data-cycle-timeout="0" data-cycle-carousel-visible="3"
data-cycle-carousel-rwd-json="{768: 1}"
data-cycle-pause-on-hover="true" data-cycle-log="false" data-cycle-carousel-fluid="true">
<li class="widget-link__item">
<div class="liWrapper">
<img class="widget-link__img" src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
</div>
<h4 class="widget-content-title"><a href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">{{title}}</a></h4>
<br>
<div class="widget-content-context"><a class="widget-content-title" href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">{{context}}</a></div>
</li>
</div>
<ul class="button-mid">
<i class="fa fa-angle-left prev-button" aria-label="<%= I18n.t("ad_banner.prev") %>"></i>
<i class="fa fa-angle-right next-button" aria-label="<%= I18n.t("ad_banner.next") %>"></i>
</ul>
</div>
</div>
<script>
$('[data-subpart-id="{{subpart-id}}"] .next-button').click(function(){
$(this).parent("ul").siblings('.widget-content').cycle("next");
})
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
$(this).parent("ul").siblings('.widget-content').cycle("prev");
})
</script>
<style type="text/css">
.widget-link_wrapper{
position: relative;
}
.widget-link.widget-4 .button-mid{
position: absolute;
width: 100%;
height: 0;
top: 50%;
}
.widget-link.widget-4 .button-mid .fa{
cursor: pointer;
}
</style>

View File

@ -65,6 +65,14 @@
"en" : "6. Banner 4 - Only Images, No title(carousel 5)"
},
"thumbnail" : "thumb.png"
},
{
"filename" : "web_res_widget7",
"name" : {
"zh_tw" : "7. 輪播5(carousel 3),顯示標題、描述",
"en" : "7. Banner 5(carousel 3), title, description"
},
"thumbnail" : "thumb.png"
}
]
}