lot of fixes and experience enhancement

This commit is contained in:
Harry Bomrah 2014-12-10 18:09:50 +08:00
parent 84308c3d10
commit 54fd95163b
11 changed files with 38 additions and 18 deletions

View File

@ -7,7 +7,7 @@ class Admin::AuthorizationsController < OrbitAdminController
if @module_apps && @module_apps.include?(@module_app)
reload_users
if (@module_app.categorizable || @module_app.categories.present?)
@objects = @module_app.categories rescue nil
@objects = @module_app.categories.order_by(:disable.asc) rescue nil
end
elsif @module_apps && @module_app.key == "authorization"
redirect_to admin_authorizations_path(@module_apps.first.key)

View File

@ -26,7 +26,7 @@ class Admin::ImportController < OrbitAdminController
msg = "Failed to connect to RSS2 (#{uri.to_s})"
end
render :json=>{"status"=>msg}
render :json=>{"status"=>msg}.to_json
end
def clean_old_data

View File

@ -290,20 +290,13 @@ class PagesController < ApplicationController
partials = []
subparts.each do |subpart|
if subpart.kind == "module_widget"
subpart_categories = []
subpart.categories.each do |c|
category = Category.find(c) rescue nil
if !category.nil? && !category.disable
subpart_categories << c
end
end
subpart_categories = ["all"] if subpart_categories.blank?
OrbitHelper.set_current_widget subpart
OrbitHelper.set_widget_data_count subpart.data_count
OrbitHelper.set_widget_module_app subpart.module
OrbitHelper.set_widget_item_url subpart
OrbitHelper.set_widget_title subpart.title
OrbitHelper.set_widget_categories subpart_categories || ["all"]
OrbitHelper.set_widget_categories subpart.categories || ["all"]
OrbitHelper.set_widget_tags subpart.tags || []
custom_value = subpart.custom_string_field || subpart.custom_array_field rescue nil
if !custom_value.nil?

View File

@ -280,7 +280,14 @@ module OrbitHelper
end
def self.set_widget_categories(categories)
@widget_categories = categories
@widget_categories = []
categories.each do |c|
category = Category.find(c) rescue nil
if !category.nil? && !category.disable
@widget_categories << c
end
end
@widget_categories = ["all"] if @widget_categories.blank?
end
def self.widget_categories

View File

@ -49,9 +49,17 @@
<h4 class="pull-left">Sub Managers</h4>
<div class="pull-right">
<label>Categories :
<%= select_tag "anything", options_from_collection_for_select(@objects, "id", "title"), :prompt => "Select Category" if !@objects.nil? %>
<%#= select_tag "anything", options_from_collection_for_select(@objects, "id", "title"), :prompt => "Select Category" if !@objects.nil? %>
<% if !@objects.nil? %>
<select id="anything" name="anything">
<option value="">Select Category</option>
<% @objects.each do |obj| %>
<option value="<%= obj.id %>" <%= obj.disable ? "class=alert-error" : "" %>><%= obj.title %></option>
<% end %>
</select>
<% end %>
</label>
<span id="disabled_message_span" class="alert alert-error pull-right hide">This category is disabled.</span>
<span id="disabled_message_span" class="alert alert-error pull-right hide"><%= t(:category_disabled) %></span>
</div>
</div>
<ul id="card-list-submanagers" class="checkbox-card clearfix">

View File

@ -4,7 +4,7 @@
<% @module_apps.each do |mod| %>
<%
@mod = mod
categories = mod.categories
categories = mod.categories.order_by(:disable.asc)
%>
<% icon_name = OrbitApp::Module::Registration.find_by_key(mod.key).get_icon_class rescue 'icons-daniel-bruce-2' %>
<p class="tag-lead lead muted"><i class="<%= icon_name %>"></i> <%= mod.title %> <span class="badge pull-right"><%= categories.count %></span></p>

View File

@ -24,7 +24,7 @@
</div>
</div>
<% end %>
<div class="text-error text-center">Category once created, cannot be deleted.</div>
<div class="text-error text-center"><%= t(:category_notice) %></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><%= t(:close) %></button>

View File

@ -25,7 +25,7 @@
</div>
<% end %>
<% end %>
<div class="text-error text-center">Category once created, cannot be deleted.</div>
<div class="text-error text-center"><%= t(:category_notice) %></div>
<%= label_tag "disable" do %>
<%= f.check_box :disable %>
<%= t(:disable) %>

View File

@ -162,3 +162,10 @@
</div>
</div>
<% end %>
<script type="text/javascript">
$("#open-orbit-login").on("change",function(){
if($(this).is(":checked")){
$("#user_user_id").focus();
}
})
</script>

View File

@ -25,7 +25,9 @@ en:
zh_tw: Chinese
zh_tw_: Traditional Chinese
zh_cn: Simplified Chinese
_locale: English
_locale: English
category_notice: "Category once created, cannot be deleted."
category_disabled: "This category is disabled."
access:
denied:
ajax_401_error: "User session has been expired,please login again."

View File

@ -5,6 +5,9 @@ zh_tw:
zh_tw_: 繁體中文
zh_cn: 简体中文
en: 英文
category_notice: 類別一但被建立,就不能刪除喔!
category_disabled: 此類別已被關閉
access:
denied:
ajax_401_error: 使用者已逾時或是登出,請重新登入