diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index 01685c3dc..cf2dfd69c 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -11,17 +11,9 @@ $(document).on('click', '.action a.remove_existing_record', function(){ $("tr #" + $(this).prev().attr('value')).hide(); }); -$('.quick_edit_cancel').live('click', function(){ +$(document).on('click', '.quick_edit_cancel', function(){ tr = $(this).attr('rel'); $('#' + tr).hide(); $("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); -}); - -$(document).on('click', '.list-remove', function(){ - $('#delete_bulletins').submit(); -}); - -$(document).on('click', '#check_all_bulletins', function(){ - $('.checkbox_in_list').attr("checked", this.checked); }); \ No newline at end of file diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js index 44fa62a39..959f04b2c 100644 --- a/app/assets/javascripts/inc/modal-preview.js +++ b/app/assets/javascripts/inc/modal-preview.js @@ -4,7 +4,7 @@ $(document).ready(function() { $("a.preview_trigger").click(function(){ - $(this).after(""); + $("#main-wrap").after(""); $.ajax({ type: 'PUT', url:$(this).attr("href"), diff --git a/app/assets/javascripts/inc/permission-checkbox.js b/app/assets/javascripts/inc/permission-checkbox.js index fc91b8579..23716f682 100644 --- a/app/assets/javascripts/inc/permission-checkbox.js +++ b/app/assets/javascripts/inc/permission-checkbox.js @@ -1,4 +1,7 @@ $(document).ready(function() { + permissionCheckbox(); +}); +function permissionCheckbox(){ $('.check[checked="checked"]').parents(".checkbox").addClass("checked") $(".checkbox").click(function(){ if($(this).children(".check").attr("checked")){ @@ -16,4 +19,4 @@ $(document).ready(function() { placement: 'bottom', delay: { show: 100, hide: 300 }, }); -}); \ No newline at end of file +}; \ No newline at end of file diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js index fcf30d120..30e8fbe36 100644 --- a/app/assets/javascripts/orbit-1.0.js +++ b/app/assets/javascripts/orbit-1.0.js @@ -1,5 +1,6 @@ var viewportwidth, viewportheight; + console.log($(window).height()) function resize() { viewportheight=$(window).height(); viewportwidth=$(window).width(); @@ -49,14 +50,20 @@ $(document).ready(function(){ resize(); var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2, $subWiget = $('#sub-wiget').width()+18; - $('#main-sidebar').css("height", viewportheight-30); - $('#main-sidebar .viewport').css("height", viewportheight-30); + $orbitBar = $('#orbit-bar').height(), + $mainSidebar = $('#main-sidebar').width()+5, + $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); + console.log($orbitBar); + console.log("ready"+$(window).height()); + $('#main-sidebar').css("height", viewportheight-$orbitBar); + $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); - $('#main-sidebar').tinyscrollbar(); + $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); + $('#bulletin_pagination').css("width", viewportwidth-$mainSidebar); + $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); $('.detal-list').tinyscrollbar(); - $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)}); mainTablePosition(); /*isotope*/ @@ -72,12 +79,18 @@ $(window).resize(function(){ resize(); var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2, $subWiget = $('#sub-wiget').width()+18; - $('#main-sidebar').css("height", viewportheight-30); - $('#main-sidebar .viewport').css("height", viewportheight-30); + $orbitBar = $('#orbit-bar').height(), + $mainSidebar = $('#main-sidebar').width()+5, + $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); + console.log(viewportheight); + $('#main-sidebar').css("height", viewportheight-$orbitBar); + $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); - $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft) - $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)}); + $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); + $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); + $('#bulletin_pagination').css("width", viewportwidth-$mainSidebar); + $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); mainTablePosition(); }); /*main-table position*/ diff --git a/app/assets/javascripts/sort_header.js b/app/assets/javascripts/sort_header.js new file mode 100644 index 000000000..25a163449 --- /dev/null +++ b/app/assets/javascripts/sort_header.js @@ -0,0 +1,7 @@ +$(document).on('click', '.list-remove', function(){ + $('#delete_all').submit(); +}); + +$(document).on('click', '#check_all', function(){ + $('.checkbox_in_list').attr("checked", this.checked); +}); \ No newline at end of file diff --git a/app/assets/stylesheets/bootstrap-orbit.css b/app/assets/stylesheets/bootstrap-orbit.css index 2c78b00ea..2ce9bc9cb 100644 --- a/app/assets/stylesheets/bootstrap-orbit.css +++ b/app/assets/stylesheets/bootstrap-orbit.css @@ -1,5 +1,5 @@ -/*bootstrap-orbit*/ - +/*bootstrap-orbit*/ + h1, h2, h3, h4, h5, h6 { font-weight:normal ; } @@ -112,6 +112,18 @@ table .span1-3 { .qe-block .form-horizontal .form-actions { text-align:right; } +.form-actions form { + margin-bottom: 0; +} +.form-actions form input { + margin-bottom: 0; +} .modal.fade { top: -50%; +} +.form-search button { + margin-bottom: 0; +} +.modal form { + margin-bottom: 0; } \ No newline at end of file diff --git a/app/assets/stylesheets/isotope.css b/app/assets/stylesheets/isotope.css index adf7cdfa4..3e7bf739c 100644 --- a/app/assets/stylesheets/isotope.css +++ b/app/assets/stylesheets/isotope.css @@ -1,18 +1,11 @@ -/*isotope*/ - +/*isotope*/ + #isotope { margin-top: 2px; - background-color:#f4f4f4; } .isotope-item { z-index: 2; } - -.isotope-hidden.isotope-item { - pointer-events: none; - z-index: 1; -} - /**** Isotope CSS3 transitions ****/ .isotope, @@ -48,28 +41,27 @@ transition-duration: 0s; } .w-a { - width: 388px; + width: 398px; } .w-b { - width: 802px; + width: 812px; } .h-a { height: 315px; } .h-b { - height: 699px; + height: 703px; } .item { margin: 5px 0 15px 15px; } .item h3 { - margin: 5px 0; + margin: 20px 0 5px; } .item h3 [class^="icons-"] { - margin: 3px 5px 0 3px; + margin: 1px 5px 0 3px; } .item .detail { - padding: 5px; border: 1px solid rgba(0, 0, 0, 0.1); background-color: #FFFFFF; border-radius: 5px; @@ -77,12 +69,11 @@ -moz-border-radius: 5px; box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); - -moz-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); } .item .detail .totle { font-size: 50px; - padding:10px 5px 20px 0; - margin: 0px; + padding:10px 5px 30px 0; + margin: 0; text-align: right; border-bottom:1px solid #d9d9d9; } @@ -92,20 +83,60 @@ color: #333; padding-left: 5px; text-align:left; + margin-bottom: -7px; +} +.item .detail .table { + margin-bottom: 0; } .item .detail .table th, .item .detail .table td { border-top: none; border-bottom: 1px solid #DDDDDD; } +.item .detail .table tr th { + background-color: #F2F2F2; + border-bottom: 1px solid #AAAAAA; +} .item .detail .table tr td:first-child { color: #666;; } -.item .detail .table tr td:last-child { +.item .detail .table tr td:last-child, .item .detail .table tr th:last-child { text-align:right; + padding-right: 15px; } .item .h-a .my_scroll .viewport { - height: 248px; + height: 210px; } .item .h-b .my_scroll .viewport { - height: 632px; + height: 594px; +} +.item .isotope-hidden.isotope-item { + pointer-events: none; + z-index: 1; +} +.item .my_scroll { + position: relative; +} +.item .my_scroll .scrollbar { + right: 3px; + top: 0; + position: absolute; + z-index: 10; +} +.item .my_scroll .track { + background-color: transparent; +} +.detail.noStatistics { + overflow: hidden; +} +.detail.noStatistics.h-a { + height: 315px; +} +.detail.noStatistics.h-a .my_scroll .viewport { + height: 280px; +} +.detail.noStatistics.h-b { + height: 704px; +} +.detail.noStatistics.h-b .my_scroll .viewport { + height: 670px; } \ No newline at end of file diff --git a/app/assets/stylesheets/list.css b/app/assets/stylesheets/list.css index eb9be54c7..b77482915 100644 --- a/app/assets/stylesheets/list.css +++ b/app/assets/stylesheets/list.css @@ -22,7 +22,7 @@ .main-list .nav-pills > li > a { border-radius: 5px 5px 5px 5px; margin: 2px; - padding:5px + padding:5px; } .main-list tbody .quick-edit { position:relative; @@ -54,6 +54,11 @@ position: relative; height: 40px; } +.main-list .label-group .label { + margin-bottom: 1px; + display: inline-block; + padding: 0 3px; +} .main-list .label-td { background-color: rgba(255, 255, 255, 1); height: 40px; @@ -99,6 +104,7 @@ .qe-block td { height:auto; padding: 0; + /*background-color: #dedede;*/ } .qe-block legend { padding-left: 8px; @@ -174,11 +180,18 @@ legend { .sort-header th a:hover { text-decoration: none; } -#check_all_bulletins { +.list-remove { position: absolute; - top: 10px; - left: 5px; + top: 0; + padding-top: 9px !important; + left: 25px; } -#sort_headers .list-remove { - padding: 8px 0 8px 16px !important; +.form-fixed { + position: fixed; + margin-bottom: 0; + bottom: 0; + z-index: 10; +} +.paginationFixed { + margin-bottom: 25px; } \ No newline at end of file diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index 8fdc39238..b1f3d582f 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -243,7 +243,7 @@ padding-right: 4px; border-right: 1px solid rgba(0,0,0,.2); position:fixed; - top: 32px; + top: 31px; z-index: 88; } #main-sidebar .nav { @@ -286,17 +286,18 @@ background-color: #FFF; margin-left:160px; padding-top: 32px; - padding-bottom: 18px; + /*padding-bottom: 18px;*/ position: relative; - min-height: 100%; + padding-bottom: 45px; + /*min-height: 100%;*/ } -#main-wrap > .form-actions { +/*#main-wrap > .form-actions { background-color: #FFF; text-align: center; padding: 17px 20px 0; margin: 0; border-top: none; -} +}*/ #main-wrap .subnav { height: auto; min-height: 36px; @@ -345,7 +346,7 @@ text-align: right; padding-left: 10px; padding-right: 10px; - margin-bottom: 0; + margin-bottom: -50px; clear: both; } #poststuff form { @@ -634,9 +635,6 @@ .adbanner-action { margin-bottom: 20px; } -#bulletin_link_qe form { - margin: 0; -} [class^="icons-"] { display: inline-block; width: 16px; @@ -925,5 +923,5 @@ } /*21*/ .icons- { - background-position: -0px -640px; -} \ No newline at end of file + background-position: -0px -640px +} diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index e93fb521a..4f373f141 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -2,7 +2,7 @@ class Admin::ModuleAppsController < ApplicationController before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ] before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ] - layout "admin" + layout "new_admin" def index @module_apps = ModuleApp.all.entries diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index e8779dc4c..ab343360d 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -1,6 +1,6 @@ class Admin::ObjectAuthsController < ApplicationController include OrbitCoreLib::PermissionUnility - layout "admin" + layout "new_admin" before_filter :force_order # before_filter :is_admin? ,:only => :index diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index 81c8b9c65..86bc674e3 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -27,8 +27,10 @@ class Admin::PagePartsController < ApplicationController @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag @tag_objects = @r_tag.classify.constantize.all rescue nil case @module_app.key - when 'bulletin' + when 'announcement' @categories = BulletinCategory.all + when 'news' + @categories = NewsBulletinCategory.all when 'web_resource' @categories = WebLinkCategory.all end @@ -65,12 +67,14 @@ class Admin::PagePartsController < ApplicationController def reload_widgets @categories =[] @module_app = ModuleApp.find(params[:id]) - - unless (@module_app.category.nil? rescue true) - @module_app.category.each do |category| - @categories << eval(category).all.entries - end - @categories.flatten! + + case @module_app.key + when 'announcement' + @categories = BulletinCategory.all + when 'news' + @categories = NewsBulletinCategory.all + when 'web_resource' + @categories = WebLinkCategory.all end respond_to do |format| diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 411297ce9..657543191 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -31,7 +31,18 @@ class Admin::PagesController < ApplicationController @designs = Design.all.entries @design = @item.design ? @item.design : @designs.first @app_frontend_urls = @item.module_app.app_pages if @item.module_app - @categories = BulletinCategory.all if @item.module_app && @item.module_app.key.eql?('announcement') + if @item.module_app + case @item.module_app.key + when 'announcement' + @categories = BulletinCategory.all + when 'news' + @categories = NewsBulletinCategory.all + when 'web_resource' + @categories = WebLinkCategory.all + end + else + @categories = nil + end end def create diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index fe37db82f..7e9fa32a8 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -12,7 +12,7 @@ class OrbitBackendController< ApplicationController @app_title = request.fullpath.split('/')[2] @module_app = ModuleApp.first(conditions: {:key => @app_title} ) end - + private def force_order @@ -22,8 +22,139 @@ class OrbitBackendController< ApplicationController def check_user_can_use unless check_permission - redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) + #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) + render :text => '403 Forbidden' end end + + def get_sorted_and_filtered(object_class) + object_class = object_class.classify.constantize + objects = object_class.all + + if !params[:sort].blank? + options = params[:sort_options] + options = [options] if !options.class.eql?(Array) + options.each do |option| + if object_class.fields.include?(option) + case object_class.fields[option].type.to_s + when 'BigDecimal', 'Boolean', 'Date', 'DateTime', 'Float', 'Integer', 'String', 'Symbol', 'Time' + (objects = objects.order_by(option, params[:direction])) rescue nil + when 'Object' + objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option) + end + elsif object_class.relations.include?(option) + case object_class.relations[option].macro + when :references_one + a = Array.new + objects.each { |object| a << [get_string_value_from_object(object), object] } + sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse! + objects = sorted.collect {|x| x[1] } + when :references_many, :references_and_referenced_in_many + objects = get_objects_from_self(object_class, objects, option) + when :referenced_in + objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id") + end + end + end + end + if @filter + @filter.each do |key, value| + case key + when 'status' + a = Array.new + objects.each do |bulletin| + value.each do |v| + case v + when 'pending' + a << bulletin if bulletin.is_checked.nil? + when 'rejected' + a << bulletin if bulletin.is_checked.eql?(false) + else + a << bulletin if bulletin[v] + end + end + end + objects = a.uniq + when 'categories' + a = Array.new + objects.each do |bulletin| + a << bulletin if value.include?(bulletin.bulletin_category.id.to_s) + end + objects = a.uniq + when 'tags' + a = Array.new + objects.each do |bulletin| + bulletin.tags.each do |tag| + a << bulletin if value.include?(tag.id.to_s) + end + end + objects = a.uniq + end if value.size > 0 + end + end + Kaminari.paginate_array(objects).page(params[:page]).per(10) + end + + def get_string_value_from_object(object) + s = object[I18n.locale] rescue nil + s = object.i18n_variable unless s rescue nil + s = object.name unless s rescue nil + s = object.title unless s rescue nil + if s + case s.class.to_s + when "String" + s.downcase + when "I18nVariable" + s[I18n.locale].downcase + else + nil + end + end + end + + def get_objects_from_referenced_objects(object_class, objects, option) + referer_ids = objects.distinct(option) + referenced_objects = object_class.find(referer_ids) rescue nil + if referenced_objects + a = Array.new + referenced_objects.each { |referer| a << [get_string_value_from_object(referer), referer.id] } + sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse! + sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries } + sorted_objects.flatten! + sorted_objects.uniq! + get_with_nil(objects, option, sorted_objects) + else + objects + end + end + + def get_objects_from_self(object_class, objects, option) + referenced_class = object_class.relations[option].class_name.constantize + referenced_objects = referenced_class.all rescue nil + if referenced_objects + reverse_relation = nil + referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) } + a = Array.new + referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] } + a.compact! + sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse! + sorted_objects = Array.new + sorted.each {|x| sorted_objects << x[1].send(reverse_relation) } + sorted_objects.flatten! + sorted_objects.uniq! + get_with_nil(objects, option, sorted_objects) + else + objects + end + end + + def get_with_nil(objects, option, sorted_objects) + tmp = Array.new + objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).count == 0) } + sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse! + sorted_tmp = sorted.collect {|a| a[1] } + a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp) + a.flatten + end end \ No newline at end of file diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 4860ea2e8..8e9f8bb6a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -33,9 +33,9 @@ class PagesController < ApplicationController def index_from_link if params[:page] - redirect_to "/#{@item.full_name}?page=#{params[:page]}" + redirect_to "/#{@item.full_name}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" else - redirect_to "/#{@item.full_name}" + redirect_to "/#{@item.full_name}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" end end @@ -51,11 +51,11 @@ class PagesController < ApplicationController def get_item module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) - if params[:category_id] - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) - else + # if params[:category_id] + # @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) + # else @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) - end + # end end end diff --git a/app/helpers/admin/module_app_helper.rb b/app/helpers/admin/module_app_helper.rb index 0a636e9cd..3ac82364f 100644 --- a/app/helpers/admin/module_app_helper.rb +++ b/app/helpers/admin/module_app_helper.rb @@ -14,6 +14,7 @@ module Admin::ModuleAppHelper end def get_auth_by(manager_obj) - "-AuthBy: " +( manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name) + showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name + t("admin.user_role.auth.auth_by",:user_display_name => showing_name) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 258000be9..682799eb7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -87,26 +87,6 @@ module ApplicationHelper ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil end - def sortable(column) - direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc" - {:sort => column, :direction => direction} - end - - def is_sort_active?(name) - res = '' - res << ' select' if params[:sort].eql?(name) - res << ' active' if params[:sort].eql?(name) && params[:direction].eql?('asc') - res - end - - def is_sort?(name) - ' web-symbol' if params[:sort].eql?(name) - end - - def is_filter_active?(type, id) - ' active' if (@filter[type].include?(id.to_s) rescue nil) - end - def process_page(page, id) parse_page_noko(page, id) end diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb new file mode 100644 index 000000000..b0da6df6e --- /dev/null +++ b/app/helpers/orbit_backend_helper.rb @@ -0,0 +1,45 @@ +module OrbitBackendHelper + + def sortable(column) + direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc" + {:sort => column, :direction => direction} + end + + def is_sort_active?(name) + res = '' + res << ' select' if params[:sort].eql?(name) + res << ' active' if params[:sort].eql?(name) && params[:direction].eql?('asc') + res + end + + def is_sort?(name) + ' web-symbol' if params[:sort].eql?(name) + end + + def is_filter_active?(type, id) + ' active' if (@filter[type].include?(id.to_s) rescue nil) + end + + def render_sort_bar(delete_all, *titles) + content_tag :table, :class => "table main-list" do + content_tag :thead do + content_tag :tr, :class => "sort-header" do + concat (content_tag :th, :class => "span1 strong" do + concat check_box_tag :check_all + concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove" + end) if delete_all + titles.each do |title| + concat render_title(title[0], title[1], title[2], title[3]) + end + end + end + end + end + + def render_title(title, fields, span, translation) + content_tag :th, :class => "sort #{span} #{is_sort_active?(title)}" do + link_to (t(translation) + content_tag(:b, nil, :class => is_sort?(title))).html_safe, url_for({:filter => @filter}.merge(sortable(title).merge(:sort_options => fields))), :class => 'js_history' + end + end + +end \ No newline at end of file diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index cac5f1a14..4a3f2db44 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -1,5 +1,5 @@ - + <% end %> - diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 9a5d438b3..d70afab39 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -8,17 +8,17 @@
-
diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index cd9ca8ae7..6c8e06361 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,21 +1,21 @@
-

All User

+

<%= t("admin.user_role.auth.all_member") %>

<%= form_tag(submit_url) do %> - <%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %>
+ <%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag t("admin.user_role.auth.all_member") %>
<% end %>
-

User Role

+

<%= t("admin.user_role.auth.user") %>

<%= form_tag(submit_url) do %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> - <%= submit_tag 'Add Role' %>
+ <%= submit_tag t("admin.user_role.auth.by_role") %>
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %> - <%= submit_tag 'Add SubRole' %>
+ <%= submit_tag t("admin.user_role.auth.by_sub_role") %>
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %> - <%= submit_tag 'Add PrivilegeList' %>
+ <%= submit_tag t("admin.user_role.auth.add_to_privilege_list") %>
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %> - <%= submit_tag 'Add BlockedList' %>
+ <%= submit_tag t("admin.user_role.auth.add_to_block_list") %>
<% end %> <% unless auth.nil? %> <% auth.roles.each do |role| %> diff --git a/app/views/admin/dashboards/index.html.erb b/app/views/admin/dashboards/index.html.erb index d038b63d4..e22d7dac8 100644 --- a/app/views/admin/dashboards/index.html.erb +++ b/app/views/admin/dashboards/index.html.erb @@ -1,197 +1,16 @@
-

Member

-
-

Quantity9,517

-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
University2,304
Master783
Doctor45
Staff62
Teacher52
Professor20
Assistant Professor41
Substitute teacher37
Lecturer41
Part-time teacher20
-
-
-
-
-
-
-

Content

-
-

Quantity9,517

-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
University2,304
Master783
Doctor45
Staff62
Teacher52
Professor20
Assistant Professor41
Substitute teacher37
Lecturer41
Part-time teacher20
-
-
-
-
-
-
-

Asset

-
-

Quantity9,517

-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
University2,304
Master783
Doctor45
Staff62
Teacher52
Professor20
Assistant Professor41
Substitute teacher37
Lecturer41
Part-time teacher20
-
-
-
-
-
-
-

Traffic

+

<%= t(:content) %>

-

Quantity9,517

+

<%= t(:all_content) %>9,517

+ + + + + + + +
<%= t(:module) %><%= t(:quantity) %>
@@ -205,128 +24,44 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
University2,304公告2,304
Master783新聞783
Doctor45連結45
Staff62連結62
Teacher52連結52
Professor20新聞20
Assistant Professor41公告41
Substitute teacher37公告37
Lecturer41公告41
Part-time teacher20
Staff62
Teacher52
Professor20
Assistant Professor41
Substitute teacher37
Lecturer41
Part-time teacher20
Staff62
Teacher52
Professor20
Assistant Professor41
Substitute teacher37
Lecturer41
Part-time teacher20
Staff62
Teacher52
Professor20
Assistant Professor41
Substitute teacher37
Lecturer41
Part-time teacher20公告20
@@ -336,72 +71,17 @@
-

Site info

-
-

Quantity9,517

-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
University2,304
Master783
Doctor45
Staff62
Teacher52
Professor20
Assistant Professor41
Substitute teacher37
Lecturer41
Part-time teacher20
-
-
-
-
-
-
-

Connection

+

<%= t(:member) %>

-

Quantity9,517

+

<%= t(:all_member) %>2,217

+ + + + + + + +
<%= t(:role) %><%= t(:quantity) %>
@@ -461,4 +141,450 @@
+
+

<%= t(:file) %>

+
+

<%= t(:all_file) %>3,422

+ + + + + + + +
<%= t(:file_type) %><%= t(:quantity) %>
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Word304
PDF783
PowerPoint45
Excel62
Jpeg52
Gif20
Png41
Avi37
Txt41
Zip20
+
+
+
+
+
+
+

<%= t(:referral_in_links) %>

+
+

<%= t(:statistics) %>517

+ + + + + + + +
<%= t(:site_name) %><%= t(:statistics) %>
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ruling36
Yahoo31
Google3,187
facebook公告
Title5公告
Title6頁面
Title7頁面
Title8公告
Title9頁面
Title10公告
+
+
+
+
+
+
+

<%= t(:most_visited_page) %>

+
+ + + + + + + + +
<%= t(:title) %><%= t(:module) %><%= t(:hits) %>
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title1公告2,549
Title2頁面1,022
Title3頁面928
Title4公告904
Title5公告867
Title6頁面830
Title7頁面749
Title8公告702
Title9頁面639
Title10公告549
Title1公告2,549
Title2頁面1,022
Title3頁面928
Title4公告904
Title5公告867
Title6頁面830
Title7頁面749
Title8公告702
Title9頁面639
Title10公告549
+
+
+
+
+
+
+

<%= t(:traffic) %>

+
+

<%= t(:total_visitors) %>438,913

+ + + + + + + +
<%= t(:item) %><%= t(:data) %>
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + +
Visitors Today2,304
Visitors This Month783
Visitor This Tear45
+
+
+
+
+
+
+

<%= t(:site_info) %>

+
+ + + + + + + + +
<%= t(:item) %><%= t(:content) %>
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title:National Chengchi University
Description:......
Keywords.....
Online Date:2012/04/30
WedID:nccu
Softwave Version:R4 beta
Warranty:Valid
+
+
+
+
+
+
+

<%= t(:recent_update) %>

+
+ + + + + + + + +
<%= t(:title) %><%= t(:module) %>
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title1公告
Title2頁面
Title3頁面
Title4公告
Title5公告
Title6頁面
Title7頁面
Title8公告
Title9頁面
Title10公告
+
+
+
+
+
\ No newline at end of file diff --git a/app/views/admin/designs/index.html.erb b/app/views/admin/designs/index.html.erb index 6195afd55..13837003b 100644 --- a/app/views/admin/designs/index.html.erb +++ b/app/views/admin/designs/index.html.erb @@ -1,24 +1,41 @@ <%= flash_messages %> + + - - - - + + + + <% @designs.each do |design| %> - +
- - - <%= t('admin.title') %><%= t('admin.author') %><%= t('admin.intro') %>
<%= design.title %>
-
-
+
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %>
\ No newline at end of file diff --git a/app/views/admin/module_apps/edit.html.erb b/app/views/admin/module_apps/edit.html.erb index 23745806b..52142feac 100644 --- a/app/views/admin/module_apps/edit.html.erb +++ b/app/views/admin/module_apps/edit.html.erb @@ -1,37 +1,30 @@ <% content_for :secondary do %> <% end %> - -
-
-
- -

<%= @module_app.title %>

+

<%= @module_app.title%>

-

Manager

-
-
Manager +
<%= t("admin.user_role.auth.manager") %> <% @module_app.managers.each do |manager| %>
<%= manager.user.name %> <%= get_auth_by(manager) %> <%= link_to '[X]',remove_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:manager) && manager.user != current_user %>
<% end %> -
Add: +
<%= form_tag(assign_manager_admin_module_app_path) do %> <%= collection_select(:manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:manager))%> - <%= submit_tag 'Add Manager' %> + <%= submit_tag t("admin.user_role.auth.add_manager") %> <% end %>
-
Sub Manager +
<%= t("admin.user_role.auth.sub_manager") %> <% @module_app.sub_managers.each do |manager| %> -
<%= manager.user.name %> -AuthBy:<%= manager.rule_creator.name %> <%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %>
+
<%= manager.user.name %> <%= get_auth_by(manager) %><%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %>
<% end %> -
Add: +
<%= form_tag(assign_sub_manager_admin_module_app_path) do %> <%= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%> - <%= submit_tag 'Add Sub Manager' %> + <%= submit_tag t("admin.user_role.auth.add_sub_manager") %> <% end %>
diff --git a/app/views/admin/object_auths/edit.html.erb b/app/views/admin/object_auths/edit.html.erb index fc824a649..3c391ef9f 100644 --- a/app/views/admin/object_auths/edit.html.erb +++ b/app/views/admin/object_auths/edit.html.erb @@ -1,11 +1,6 @@ <% content_for :secondary do %> <% end %> - -
-
-
-

<%= @object_auth.title %>

<%= render :partial => "admin/components/user_role_management", :locals => { diff --git a/app/views/admin/page_parts/_widget_categories.html.erb b/app/views/admin/page_parts/_widget_categories.html.erb index ce037d395..60659036b 100644 --- a/app/views/admin/page_parts/_widget_categories.html.erb +++ b/app/views/admin/page_parts/_widget_categories.html.erb @@ -1 +1 @@ - <%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil) if @categories && @categories.size > 0 %> \ No newline at end of file + <%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil), :include_blank => true if @categories && @categories.size > 0 %> \ No newline at end of file diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index 6c211d011..5271af8f5 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -27,7 +27,7 @@ <%= t('admin.module_app') %> <%= render :partial => "app_selector", :locals => { :f => f } %> <%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> - <%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category] ) rescue ''%> + <%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%>

<%= f.label :is_published, "#{t('admin.is_published')} ?" %> diff --git a/app/views/admin/tags/index.html.erb b/app/views/admin/tags/index.html.erb index cca4b6afc..2056bdd88 100644 --- a/app/views/admin/tags/index.html.erb +++ b/app/views/admin/tags/index.html.erb @@ -1,4 +1,4 @@ -