module page updates

This commit is contained in:
Harry Bomrah 2018-02-05 17:47:52 +08:00
parent b36bb26358
commit 98db5a9fb6
9 changed files with 305 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,145 @@
#module-store{
margin-top: 100px;
margin-bottom: 50px;
margin-left: 20px;
.filter{
border: 1px solid #3e97f1;
display: inline-block;
background-color: #f0f0f0;
// box-shadow: 5px 5px #cecece;
width: 225px;
min-height: 300px;
color: #3e6fd4;
border-radius: 5px;
h3{
background-color: #3e97f1;
color: #fff;
margin-top: 0px;
padding-top: 10px;
text-align: center;
border-bottom: 1px solid #7c7c7c;
padding-bottom: 10px;
font-size: 20px;
border-radius: 5px 5px 0 0;
// box-shadow: 5px 0 #3e97f1;
}
.filter-checkbox{
padding: 0;
margin: 0 5px;
padding-bottom: 5px;
height: 15px;
}
label{
margin-bottom: 0px;
}
.module-type {
ul{
margin-top: 20px;
list-style: none;
padding-left: 15px;
li{
margin-bottom: 10px;
}
}
}
.tag-filter{
h4{
margin-left: 10px;
font-size: 17px;
margin-top: 5px;
}
ul{
margin-top: 20px;
list-style: none;
padding-left: 15px;
li{
margin-bottom: 10px;
}
}
}
.filter-column {
padding: 10px;
margin: 10px;
padding-bottom: 15px;
border-bottom: 1px dotted #7c7c7c;
}
}
.app-holder{
display: inline-block;
vertical-align: top;
margin-left: 50px;
width: calc(100% - 300px);
h3.heading{
margin-top: 0px;
margin-bottom: 35px;
padding-bottom: 15px;
border-bottom: 1px dotted #7d7d7d;
color: #7d7d7d;
}
ul.app-list{
list-style: none;
li.app{
display: inline-block;
width: 200px;
height: 250px;
margin-right: 50px;
margin-bottom: 75px;
border-radius: 2px;
color: #fff;
text-align: center;
&.optional{
background-color: #cfb891;
.icon {
i{
color: #a76664;
}
}
}
&.default{
background-color: #99b0c7;
.icon {
i{
color: #3471af;
}
}
}
div.icon{
// border: 1px solid #cecece;
background-color: #fff;
font-size: 6em;
width: calc(100% - 10px);
margin-top: 5px;
margin-bottom: 10px;
i.no-logo{
font-size: 0.4em;
}
}
div.app-info{
margin-left: 20px;
text-align: left;
.name{
font-size: 18px;
font-weight: bold;
}
}
div.module-type{
display: inline;
position: relative;
bottom: -20px;
padding: 0 10px;
border-radius: 10px;
// margin: 20px 5px 0 5px;
// width: calc(100% - 10px);
background-color: #fff;
color: #7c7c7c;
font-weight: bold;
font-size: 16px;
}
}
}
}
}

View File

@ -0,0 +1,10 @@
class RegisterModulesController < ApplicationController
def index
@data = {}
ma = ModuleApp.where(:key => "register_module").first
@data["tags"] = ma.tags
@data["categories"] = ma.categories.enabled
@data["apps"] = RegisteredModule.can_display
@data
end
end

View File

@ -7,6 +7,7 @@ class RegisteredModule
field :module_key field :module_key
field :git_path field :git_path
field :icon_class
field :name, as: :slug_title, localize: true field :name, as: :slug_title, localize: true
field :description, localize: true field :description, localize: true
field :create_user_id, type: BSON::ObjectId field :create_user_id, type: BSON::ObjectId
@ -15,6 +16,9 @@ class RegisteredModule
field :completed, type: Boolean, :default => false field :completed, type: Boolean, :default => false
field :module_type, type: BSON::ObjectId field :module_type, type: BSON::ObjectId
field :step_number, type: Integer field :step_number, type: Integer
field :display_in_frontend, type: Boolean, :default => false
scope :can_display, ->{where(:display_in_frontend => true)}
mount_uploader :template, TemplateUploader mount_uploader :template, TemplateUploader
@ -27,4 +31,8 @@ class RegisteredModule
self.save self.save
end end
def get_colour_class
self.category.title == "Default" ? "default" : "optional"
end
end end

View File

@ -70,12 +70,26 @@
<!-- Git Path --> <!-- Git Path -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t("register_module.git_path") %></label> <%= f.label :git_path, t("register_module.git_path"), :class => "control-label muted" %>
<div class="controls col-5"> <div class="controls col-5">
<%= f.text_field :git_path, :class => "input-xxlarge" %> <%= f.text_field :git_path, :class => "input-xxlarge" %>
</div> </div>
</div> </div>
<!-- icon class -->
<div class="control-group">
<%= f.label :icon_class, t("register_module.icon_class"), :class => "control-label muted" %>
<div class="controls col-5">
<%= f.text_field :icon_class %>
</div>
</div>
<!-- display in frontend -->
<div class="control-group">
<%= f.label :display_in_frontend, t("register_module.display_in_frontend"), :class => "control-label muted" %>
<div class="controls col-5">
<%= f.check_box :display_in_frontend %>
</div>
</div>
</div> </div>
<!-- Tag Module --> <!-- Tag Module -->
@ -136,6 +150,17 @@
<% @site_in_use_locales.each_with_index do |locale, i| %> <% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>"> <div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- title -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:title) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :name_translations do |f| %>
<%= f.text_field locale, rows: 5, class: "input-block-level", :value => (@rm.name_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<!-- Content --> <!-- Content -->
<div class="control-group input-content"> <div class="control-group input-content">

View File

@ -0,0 +1,85 @@
<% OrbitHelper.render_css_in_head(["register_module/module_store.scss"]) %>
<%
data = action_data
categories = data["categories"]
tags = data["tags"]
apps = data["apps"]
%>
<div id="module-store">
<div class="filter">
<h3><%= t("register_module.filter") %></h3>
<div class="module-type filter-column">
<ul>
<% categories.each do |category| %>
<li>
<input type="checkbox" id="module_type_<%= category.id.to_s %>" class="filter-checkbox category-checkbox" data-filter="<%= category.id.to_s %>">
<label for="module_type_<%= category.id.to_s %>"><%= category.title %></label>
</li>
<% end %>
</ul>
</div>
<div class="tag-filter filter-column">
<h4><%= t("tags") %></h4>
<ul>
<% tags.each do |tag| %>
<li>
<input type="checkbox" id="tag_<%= tag.id.to_s %>" data-filter="<%= tag.id.to_s %>" class="filter-checkbox tag-checkbox">
<label for="tag_<%= tag.id.to_s %>"><%= tag.name %></label>
</li>
<% end %>
</ul>
</div>
</div>
<div class="app-holder">
<h3 class="heading"><%= t("register_module.modules") %></h3>
<ul class="app-list">
<% apps.each do |app| %>
<li class="app <%= app.get_colour_class %>" data-filter-tags='<%= app.tags.collect{|tag| tag.id.to_s}.to_s.html_safe %>' data-filter-type="<%= app.category.id.to_s %>">
<div class="icon">
<% if !app.icon_class.nil? %>
<i class="<%= app.icon_class %>"></i>
<% else %>
<i class="no-logo">No Logo</i>
<% end %>
</div>
<div class="app-info">
<div class="name"><%= app.name %></div>
<div class="company">RulingDigital</div>
</div>
<div class="module-type">
<%= app.category.title %>
</div>
</li>
<% end %>
</ul>
</div>
</div>
<script type="text/javascript">
var categories = [],
tags = [];
$(".category-checkbox").on("click",function(){
var val = $(this).data("filter");
if($(this).is(":checked")){
if(categories.indexOf(val) == -1){
categories.push(val);
}
}else{
var idx = categories.indexOf(val);
if(idx > -1){
categories.splice(idx,1);
}
}
filterApps();
})
var filterApps = function(){
$(".app-holder li.app").fadeIn();
$.each(categories,function(idx, cat){
$(".app-holder li.app[data-filter-type="+ cat +"]").fadeIn();
$(".app-holder li.app:not([data-filter-type="+ cat +"])").fadeOut();
})
}
</script>

View File

@ -9,6 +9,11 @@ en:
developed_by: Developed By developed_by: Developed By
actions: Actions actions: Actions
register_module: register_module:
filter: Filter
modules: Modules
display_in_frontend: Display in frontend
default_module: Default Modules
optional_module: Optional Modules
customization_log: Customization Log customization_log: Customization Log
desktop_widgets: Desktop Widgets desktop_widgets: Desktop Widgets
register_module: Registered Modules register_module: Registered Modules

View File

@ -9,6 +9,11 @@ zh_tw:
developed_by: Developed By developed_by: Developed By
actions: Actions actions: Actions
register_module: register_module:
filter: Filter
modules: Modules
display_in_frontend: Display in frontend
default_module: Default Modules
optional_module: Optional Modules
customization_log: Customization Log customization_log: Customization Log
register_module: Registered Modules register_module: Registered Modules
desktop_widgets: Desktop Widgets desktop_widgets: Desktop Widgets

View File

@ -7,6 +7,10 @@ module RegisterModules
authorizable authorizable
categorizable categorizable
taggable "RegisteredModule" taggable "RegisteredModule"
widget_methods ['widget']
widget_settings [{"data_count"=>30}]
frontend_enabled
data_count 1..30
side_bar do side_bar do
head_label_i18n 'register_module.register_module', icon_class: "icons-mouse" head_label_i18n 'register_module.register_module', icon_class: "icons-mouse"
@ -32,6 +36,22 @@ module RegisterModules
:active_for_action=>{'admin/admin_modules'=>"index"}, :active_for_action=>{'admin/admin_modules'=>"index"},
:available_for => 'managers' :available_for => 'managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'register_module').id}",
:priority=>3,
:active_for_action=>{'admin/register_modules'=>'categories'},
:active_for_category => 'RegisterModule',
:available_for => 'managers'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'register_module').id}",
:priority=>4,
:active_for_action=>{'admin/register_modules'=>'tags'},
:active_for_tag => 'RegisterModule',
:available_for => 'managers'
end end
end end
end end