From 42cfe5ac916e24cfac895bb4cba52bc45810d7ab Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 11 Sep 2012 10:52:27 +0800 Subject: [PATCH] first version for new member html --- app/controllers/application_controller.rb | 2 +- app/controllers/pages_controller.rb | 3 +- app/models/user/user.rb | 1 + .../users_new_interface/_filter.html.erb | 94 ++++++++++++ .../_index_paginator.html.erb | 17 +++ .../_user_for_listing.html.erb | 37 +++++ .../_user_for_summary.html.erb | 30 ++++ .../_user_for_thumbnail.html.erb | 22 +++ .../admin/users_new_interface/index.html.erb | 18 +++ .../index_summary.html.erb | 9 ++ .../index_thumbnail.html.erb | 8 ++ .../admin/users_new_interface/show.html.erb | 135 ++++++++++++++++++ app/views/layouts/_side_bar.html.erb | 28 +++- config/locales/zh_tw.yml | 32 ++++- config/routes.rb | 1 + 15 files changed, 426 insertions(+), 11 deletions(-) create mode 100644 app/views/admin/users_new_interface/_filter.html.erb create mode 100644 app/views/admin/users_new_interface/_index_paginator.html.erb create mode 100644 app/views/admin/users_new_interface/_user_for_listing.html.erb create mode 100644 app/views/admin/users_new_interface/_user_for_summary.html.erb create mode 100644 app/views/admin/users_new_interface/_user_for_thumbnail.html.erb create mode 100644 app/views/admin/users_new_interface/index.html.erb create mode 100644 app/views/admin/users_new_interface/index_summary.html.erb create mode 100644 app/views/admin/users_new_interface/index_thumbnail.html.erb create mode 100644 app/views/admin/users_new_interface/show.html.erb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 74274eeb..16b2c493 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base protect_from_forgery - include ParserFrontEnd, ParserBackEnd + include ParserFrontEnd, ParserBackEnd,ApplicationHelper layout :layout_by_resource diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index bfc4f403..e8de7132 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -17,7 +17,8 @@ class PagesController < ApplicationController def show #begin @item = Item.first(:conditions => {:path => params[:page_name]}) - if @item && @item.is_published #&& (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) + #binding.pry + if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) impressionist(@item) case @item.class.to_s when 'Page' diff --git a/app/models/user/user.rb b/app/models/user/user.rb index 3df40a3b..ce809ab8 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -27,6 +27,7 @@ class User has_many :papers, :autosave => true, :dependent => :destroy belongs_to :role + has_and_belongs_to_many :roles has_and_belongs_to_many :sub_roles accepts_nested_attributes_for :attribute_values, :allow_destroy => true diff --git a/app/views/admin/users_new_interface/_filter.html.erb b/app/views/admin/users_new_interface/_filter.html.erb new file mode 100644 index 00000000..92752c8f --- /dev/null +++ b/app/views/admin/users_new_interface/_filter.html.erb @@ -0,0 +1,94 @@ + \ No newline at end of file diff --git a/app/views/admin/users_new_interface/_index_paginator.html.erb b/app/views/admin/users_new_interface/_index_paginator.html.erb new file mode 100644 index 00000000..381ed352 --- /dev/null +++ b/app/views/admin/users_new_interface/_index_paginator.html.erb @@ -0,0 +1,17 @@ +
+ <%= link_to(new_admin_users_new_interface_path,:class=> "btn btn-primary pull-right") do%> + <%= t("admin.new_admin.action.add")%> + <% end -%> + +
diff --git a/app/views/admin/users_new_interface/_user_for_listing.html.erb b/app/views/admin/users_new_interface/_user_for_listing.html.erb new file mode 100644 index 00000000..6d453590 --- /dev/null +++ b/app/views/admin/users_new_interface/_user_for_listing.html.erb @@ -0,0 +1,37 @@ + + + +
+
+ # TODO:Teacher + # TODO:Student + # TODO:Staff +
+
+ + + <%= user_for_listing.name %> +
+ +
+ + # TODO + # TODO + + 10,597 +

+ + \ No newline at end of file diff --git a/app/views/admin/users_new_interface/_user_for_summary.html.erb b/app/views/admin/users_new_interface/_user_for_summary.html.erb new file mode 100644 index 00000000..27127142 --- /dev/null +++ b/app/views/admin/users_new_interface/_user_for_summary.html.erb @@ -0,0 +1,30 @@ +
  • + + + + + + + +
    +
    +

    +
    +

    + <%= image_tag(user_for_summary.avatar.thumb.url) %> +
    +
    +

    + <%= user_for_summary.name%> +

    +
    + #TODO 教授兼系主任#TODO 大學部校友 +
    +
      +
    • #TODO 258Publications
    • +
    • #TODO 16Courses
    • +
    • #TODO 10,578Followers
    • +
    +
    +
    +
  • \ No newline at end of file diff --git a/app/views/admin/users_new_interface/_user_for_thumbnail.html.erb b/app/views/admin/users_new_interface/_user_for_thumbnail.html.erb new file mode 100644 index 00000000..ac320227 --- /dev/null +++ b/app/views/admin/users_new_interface/_user_for_thumbnail.html.erb @@ -0,0 +1,22 @@ +
  • + + + + + + + +
    +
    +

    +
    +

    + <%= image_tag(user_for_thumbnail.avatar.thumb.url) %> +
    +
    +

    + <%= user_for_thumbnail.name%> +

    +
    +
    +
  • \ No newline at end of file diff --git a/app/views/admin/users_new_interface/index.html.erb b/app/views/admin/users_new_interface/index.html.erb new file mode 100644 index 00000000..2e58ab72 --- /dev/null +++ b/app/views/admin/users_new_interface/index.html.erb @@ -0,0 +1,18 @@ + <%= render :partial => "filter"%> + + + + + + + + + + + + + <%= render :partial => "user_for_listing",:collection=> [@users.first]%> + +
    + + <%= render :partial=> "index_paginator" %> diff --git a/app/views/admin/users_new_interface/index_summary.html.erb b/app/views/admin/users_new_interface/index_summary.html.erb new file mode 100644 index 00000000..ac568bfe --- /dev/null +++ b/app/views/admin/users_new_interface/index_summary.html.erb @@ -0,0 +1,9 @@ + <%= render :partial => "filter"%> +
    + +
    + <%= render :partial=> "index_paginator" %> \ No newline at end of file diff --git a/app/views/admin/users_new_interface/index_thumbnail.html.erb b/app/views/admin/users_new_interface/index_thumbnail.html.erb new file mode 100644 index 00000000..35eb6a18 --- /dev/null +++ b/app/views/admin/users_new_interface/index_thumbnail.html.erb @@ -0,0 +1,8 @@ + <%= render :partial => "filter"%> +
    +
    + <%= render :partial=> "index_paginator" %> \ No newline at end of file diff --git a/app/views/admin/users_new_interface/show.html.erb b/app/views/admin/users_new_interface/show.html.erb new file mode 100644 index 00000000..d6a83048 --- /dev/null +++ b/app/views/admin/users_new_interface/show.html.erb @@ -0,0 +1,135 @@ +
    +
    +

    + <%= image_tag(@user.avatar.url) %> +
    + +
    +
    + + +
    \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index f98984a3..68b4bb02 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -36,6 +36,22 @@ <%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> <%# end -%> +<%= content_tag :li, :class => active_for_controllers('users_new_interface') do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.new_admin.user'), admin_users_new_interface_index_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('users_new_interface')) do -%> + <%= content_tag :li, link_to(t('admin.new_admin.side_bar.all_user'), ), :class => active_for_action('users_new_interface', 'index') %> + <%= content_tag :li, link_to("#TODO Role1", ), :class => active_for_action('users_new_interface', 'index') %> + <%= content_tag :li, link_to(t("#TODO Role2"), ), :class => active_for_action('users_new_interface', 'index') %> + <%= content_tag :li, link_to(t('admin.new_admin.side_bar.add_user')) %> + <%= content_tag :li, link_to(t('admin.new_admin.side_bar.user_roles')) %> + <%= content_tag :li, link_to(t('admin.new_admin.side_bar.user_info')) %> + <% end -%> + +<% end -%> + + + + <%= content_tag :li, :class => active_for_controllers('page_contexts') || active_for_app_auth('page_content') || active_for_ob_auths_object("PageContext") do -%> <%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%> @@ -56,6 +72,7 @@ <% end -%> <% end %> + <%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') || active_for_app_auth('web_resource') || active_for_ob_auths_object("WebLinkCategory") do -%> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%> @@ -66,16 +83,15 @@ <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "web_resource"}))), :class => active_for_app_auth('web_resource') if (is_admin? rescue nil) %> <% end -%> <% end -%> - -<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("orbit_gallery") do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %> +<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("gallery") do -%> + <%#= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_galleries') ) do -%> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> - <%= content_tag :li, link_to(t('gallery.categories'), panel_gallery_back_end_categorylist_path), :class => active_for_action('/panel/gallery/back_end/categorylist','categorylist') %> - <%= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "orbit_gallery"}))), :class => active_for_app_auth('orbit_gallery') if (is_admin? rescue nil) %> + <%#= content_tag :li, link_to(t('gallery.categories'), panel_gallery_back_end_categorylist_path), :class => active_for_action('/panel/gallery/back_end/categorylist','categorylist') %> + <%#= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "gallery"}))), :class => active_for_app_auth('orbit_gallery') if (is_admin? rescue nil) %> <% end -%> <% end %> <%#= content_tag :li, :class => active_for_controllers('assets', '/admin/asset_tags', 'asset_categories') do -%> diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index d8483ece..81f974f5 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -210,9 +210,35 @@ zh_tw: no_home_page: 您沒有首頁 no_layout: 您沒有佈局 name: 名稱 - nccu: 政大客制 - nccu_c: - nccu_ldap_uid: NCCU LDAP 帳號 + new_admin: + side_bar: + all_user: 所有使用者 + add_user: 新增使用者 + user_roles: 角色 + user_info: 使用者資訊 + user: 會員 + action: + add: 新增 + edit: 編輯 + delete: 刪除 + quick_edit: 快速編輯 + next: 下一頁 + prev: 上一頁 + attributes: + roles: 角色 + name: 名稱 + publications: 出版數 + courses: 開課數 + followers: 被關注數 + show_mode: + index: 清單 + summary: 摘要 + thumbnail: 縮圖 + table_header: + status: 狀態 + category: 分類 + tags: 標籤 + clear_filter: 重置 new_asset: 新增資產 new_component: 新增元件 new_design: 新設計 diff --git a/config/routes.rb b/config/routes.rb index 64e2648a..0293f3b2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -127,6 +127,7 @@ Orbit::Application.routes.draw do resources :tags resources :translations resources :users + resources :users_new_interface end # end admin