diff --git a/app/assets/images/register_module/logo-default.png b/app/assets/images/register_module/logo-default.png new file mode 100644 index 0000000..173223d Binary files /dev/null and b/app/assets/images/register_module/logo-default.png differ diff --git a/app/assets/stylesheets/register_module/module_store.scss b/app/assets/stylesheets/register_module/module_store.scss new file mode 100644 index 0000000..239c67d --- /dev/null +++ b/app/assets/stylesheets/register_module/module_store.scss @@ -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; + } + } + } + } +} \ No newline at end of file diff --git a/app/controllers/register_modules_controller.rb b/app/controllers/register_modules_controller.rb new file mode 100644 index 0000000..de57a68 --- /dev/null +++ b/app/controllers/register_modules_controller.rb @@ -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 \ No newline at end of file diff --git a/app/models/registered_module.rb b/app/models/registered_module.rb index 1c48196..dbe48a2 100644 --- a/app/models/registered_module.rb +++ b/app/models/registered_module.rb @@ -7,6 +7,7 @@ class RegisteredModule field :module_key field :git_path + field :icon_class field :name, as: :slug_title, localize: true field :description, localize: true field :create_user_id, type: BSON::ObjectId @@ -15,6 +16,9 @@ class RegisteredModule field :completed, type: Boolean, :default => false field :module_type, type: BSON::ObjectId 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 @@ -27,4 +31,8 @@ class RegisteredModule self.save end + def get_colour_class + self.category.title == "Default" ? "default" : "optional" + end + end \ No newline at end of file diff --git a/app/views/admin/admin_modules/uploadfiles.html.erb b/app/views/admin/admin_modules/uploadfiles.html.erb index ce6eb31..4953836 100644 --- a/app/views/admin/admin_modules/uploadfiles.html.erb +++ b/app/views/admin/admin_modules/uploadfiles.html.erb @@ -70,12 +70,26 @@
- + <%= f.label :git_path, t("register_module.git_path"), :class => "control-label muted" %>
<%= f.text_field :git_path, :class => "input-xxlarge" %>
+ +
+ <%= f.label :icon_class, t("register_module.icon_class"), :class => "control-label muted" %> +
+ <%= f.text_field :icon_class %> +
+
+ +
+ <%= f.label :display_in_frontend, t("register_module.display_in_frontend"), :class => "control-label muted" %> +
+ <%= f.check_box :display_in_frontend %> +
+
@@ -136,6 +150,17 @@ <% @site_in_use_locales.each_with_index do |locale, i| %>
"> + +
+ +
+
+ <%= 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 %> +
+
+
diff --git a/app/views/register_modules/index.html.erb b/app/views/register_modules/index.html.erb new file mode 100644 index 0000000..b7965c9 --- /dev/null +++ b/app/views/register_modules/index.html.erb @@ -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"] +%> +
+
+

<%= t("register_module.filter") %>

+
+
    + <% categories.each do |category| %> +
  • + + +
  • + <% end %> +
+
+
+

<%= t("tags") %>

+
    + <% tags.each do |tag| %> +
  • + + +
  • + <% end %> +
+
+
+
+

<%= t("register_module.modules") %>

+
    + <% apps.each do |app| %> +
  • +
    + <% if !app.icon_class.nil? %> + + <% else %> + + <% end %> +
    +
    +
    <%= app.name %>
    +
    RulingDigital
    +
    +
    + <%= app.category.title %> +
    +
  • + <% end %> +
+
+
+ + + + diff --git a/config/locales/en.yml b/config/locales/en.yml index 3f879ba..83d5336 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -9,6 +9,11 @@ en: developed_by: Developed By actions: Actions register_module: + filter: Filter + modules: Modules + display_in_frontend: Display in frontend + default_module: Default Modules + optional_module: Optional Modules customization_log: Customization Log desktop_widgets: Desktop Widgets register_module: Registered Modules diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 2bc8eb3..d9e17fa 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -9,6 +9,11 @@ zh_tw: developed_by: Developed By actions: Actions register_module: + filter: Filter + modules: Modules + display_in_frontend: Display in frontend + default_module: Default Modules + optional_module: Optional Modules customization_log: Customization Log register_module: Registered Modules desktop_widgets: Desktop Widgets diff --git a/lib/register_modules/engine.rb b/lib/register_modules/engine.rb index 5fe8f9e..243c3c8 100644 --- a/lib/register_modules/engine.rb +++ b/lib/register_modules/engine.rb @@ -7,6 +7,10 @@ module RegisterModules authorizable categorizable taggable "RegisteredModule" + widget_methods ['widget'] + widget_settings [{"data_count"=>30}] + frontend_enabled + data_count 1..30 side_bar do head_label_i18n 'register_module.register_module', icon_class: "icons-mouse" @@ -26,12 +30,28 @@ module RegisterModules :active_for_action=>{'admin/register_desktop_widgets'=>"index"}, :available_for => 'users' - context_link 'register_module.admin_area', + context_link 'register_module.admin_area', :link_path=>"admin_admin_modules_path" , :priority=>3, :active_for_action=>{'admin/admin_modules'=>"index"}, :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