diff --git a/app/assets/javascripts/ajaxUpload/view.js b/app/assets/javascripts/ajaxUpload/view.js index 601091e64acfa9b5d8fe649809a5bf58593510d5..d0c6c9875d1c1d5a544a476af371a542ff654f59 100644 --- a/app/assets/javascripts/ajaxUpload/view.js +++ b/app/assets/javascripts/ajaxUpload/view.js @@ -26,12 +26,12 @@ ajaxUpload.view = { message: ajaxUpload.upload.getMessage(), pending: pending }); - this.container.classList.remove("hidden"); + this.container.classList.remove("hide"); }, hide: function() { if (this.container.innerHTML != "") { setTimeout((function () { - this.container.classList.add("hidden") + this.container.classList.add("hide") this.container.innerHTML = "" }).bind(this),1000); } diff --git a/app/controllers/common/posts.rb b/app/controllers/common/posts.rb new file mode 100644 index 0000000000000000000000000000000000000000..489975a1c8ea41c99a8c66bea164f3e458b3807f --- /dev/null +++ b/app/controllers/common/posts.rb @@ -0,0 +1,61 @@ +# +# Controllers that include this must define: +# +# Paths: +# +# edit_post_path(post, *args) -- path for editing post. +# post_path(post, *args) -- path for updating the post. +# posts_path(*args) -- path to create a post. +# +# Permissions: +# +# may_create_post?() +# may_edit_post?(post) +# +# +module Common::Posts + + def edit + render(:update) do |page| + page.replace(@post.body_id, :partial => 'common/posts/table/edit', :locals => {:post => @post}) + end + end + + def update + if params[:destroy] + @post.destroy + render :update do |page| + page.hide @post.dom_id + end + else + if params[:save] + @post.update_attribute('body', params[:post][:body]) + end + render :update do |page| + page.replace(@post.body_id, :partial => 'common/posts/table/body', :locals => {:post => @post}) + end + end + end + + # + # destroy a request. + # uses model permissions. + # + def destroy + @request.destroy_by!(current_user) + notice :thing_destroyed.tcap(:thing => I18n.t(@request.name)), :later + render(:update) {|page| page.redirect_to requests_path} + end + + protected + + def render_posts_refresh(posts) + @post = Post.new # for the reply form + render :update do |page| + standard_update(page) + page.replace('posts', :partial => 'common/posts/list', :locals => {:style => 'table', :posts => posts}) + end + end + +end + diff --git a/app/controllers/groups/directory_controller.rb b/app/controllers/groups/directory_controller.rb index 06c753d0f20426a55995d48ee7a3521c880d3287..82a2c70b59f524ae94636777ac4fd2f62f4a0d80 100644 --- a/app/controllers/groups/directory_controller.rb +++ b/app/controllers/groups/directory_controller.rb @@ -6,13 +6,7 @@ class Groups::DirectoryController < ApplicationController permission_helper 'groups/structures' def index - if !logged_in? - @groups = Group.with_access(:public => :view).groups_and_networks.paginate(pagination_params) - elsif my_groups? - @groups = current_user.primary_groups_and_networks.paginate(pagination_params) - else - @groups = Group.with_access(current_user => :view).groups_and_networks.paginate(pagination_params) - end + @groups = groups_to_display.alphabetized(nil).paginate(pagination_params) end protected @@ -22,5 +16,14 @@ class Groups::DirectoryController < ApplicationController params[:path].try.include? 'my' end + def groups_to_display + if !logged_in? + Group.with_access(:public => :view).groups_and_networks + elsif my_groups? + current_user.primary_groups_and_networks + else + Group.with_access(current_user => :view).groups_and_networks + end + end end diff --git a/app/controllers/groups/home_controller.rb b/app/controllers/groups/home_controller.rb index 1815a65634482bcbb3c5e11b2b2ab263bb82b852..1e125a2f9be9fd4b8dc32cbe48e7c05e4310df9f 100644 --- a/app/controllers/groups/home_controller.rb +++ b/app/controllers/groups/home_controller.rb @@ -8,8 +8,8 @@ class Groups::HomeController < Groups::BaseController layout 'sidecolumn' helper 'groups/wikis', 'wikis/base', 'wikis/sections' permission_helper 'wikis' - javascript :wiki - stylesheet 'wiki_edit' + javascript :upload + stylesheet 'wiki_edit', 'upload' def initialize(options = {}) @group = options[:group] @@ -24,7 +24,7 @@ class Groups::HomeController < Groups::BaseController protected def fetch_wikis - if current_user.member_of? @group + if may_edit_group? @private_wiki = @group.private_wiki @public_wiki = @group.public_wiki @wiki = coming_from_wiki?(@public_wiki) || !@private_wiki ? @public_wiki : @private_wiki @@ -36,9 +36,7 @@ class Groups::HomeController < Groups::BaseController helper_method :coming_from_wiki? # will return true if we came from the wiki editor, versions or diffs def coming_from_wiki?(wiki) - return unless wiki and request.referer - request.referer == edit_group_wiki_url(@group, wiki) or - request.referer.index(root_url + 'wikis/' + wiki.to_param ) + wiki and params[:wiki_id].to_i == wiki.id end end diff --git a/app/controllers/groups/profiles_controller.rb b/app/controllers/groups/profiles_controller.rb index c136b5085e06261b9b3ee66b594f95652cdc56c0..cc77d2a5122e462177aee8df1e6b01a6579e2fee 100644 --- a/app/controllers/groups/profiles_controller.rb +++ b/app/controllers/groups/profiles_controller.rb @@ -1,6 +1,7 @@ class Groups::ProfilesController < Groups::BaseController before_filter :fetch_profile + helper :profile def edit end diff --git a/app/controllers/groups/wikis_controller.rb b/app/controllers/groups/wikis_controller.rb index d96d7c343a2337b6a1273ef557d31b40e5efaa15..bdfe67a03fe998b2a6d615f3f9a73c7a85bdf370 100644 --- a/app/controllers/groups/wikis_controller.rb +++ b/app/controllers/groups/wikis_controller.rb @@ -8,8 +8,8 @@ class Groups::WikisController < Groups::BaseController def new if @wiki = @profile.wiki # the wiki has been created by another user since the link to - # new was displayed - so we just display it. - render :template => '/common/wiki/show' + # new was displayed - so we reload the group home instead. + render :template => '/groups/home/reload' else @wiki = Wiki.new :private => fetch_private? render :template => '/wikis/wikis/edit' @@ -30,7 +30,7 @@ class Groups::WikisController < Groups::BaseController success end end - redirect_to entity_path(@group || @page) + redirect_to group_home_path(@group, :wiki_id => @wiki.id) end diff --git a/app/controllers/me/posts_controller.rb b/app/controllers/me/posts_controller.rb index 309f52d6795dc716f30ca0b60617580b39ae92cb..7c08a6494030b48a5ba72d1b7c119d6820bb380f 100644 --- a/app/controllers/me/posts_controller.rb +++ b/app/controllers/me/posts_controller.rb @@ -3,51 +3,65 @@ # class Me::PostsController < Me::BaseController - prepend_before_filter :fetch_recipient + + include_controllers 'common/posts' + + prepend_before_filter :fetch_data + guard :may_ALIAS_post? # /me/discussions/green/posts def index - @other_user = User.find_by_login(params[:discussion_id]) - @discussion = current_user.discussions.from_user(@other_user).first + @other_user = @recipient @discussion.mark!(:read, current_user) @posts = @discussion.posts.paginate(post_pagination_params) end - def update - end - def create in_reply_to = Post.find_by_id(params[:in_reply_to_id]) current_user.send_message_to!(@recipient, params[:post][:body], in_reply_to) - respond_to do |wants| - wants.html { redirect_to me_discussion_posts_url(@recipient.login)} - wants.js { render :nothing => true } - end + render_posts_refresh(@discussion.posts.paginate(post_pagination_params)) end protected - def fetch_recipient - @recipient = User.find_by_login(params[:discussion_id]) - redirect_to me_discussions_url if @recipient.blank? - end - - def authorized? - if current_user == @recipient - redirect_to me_discussions_url - error :message_to_self_error.t - elsif !@recipient.may_be_pestered_by?(current_user) + def fetch_data + if params[:discussion_id] + @recipient = User.find_by_login(params[:discussion_id]) + @discussion = current_user.discussions.from_user(@recipient).first + end + if @recipient.blank? redirect_to me_discussions_url - error :message_cant_pester_error.t(:user => @recipient.name) end - true + if params[:id] && @discussion + @post = @discussion.posts.find(params[:id]) + end end private def post_pagination_params - default_page = params[:page].blank? ? @discussion.last_page : nil - pagination_params(:page => default_page) + #default_page = params[:page].blank? ? @discussion.last_page : params[:page] + #pagination_params(:page => default_page) + pagination_params + end + + # + # Define the path for editing posts. This is used by the post templates. + # + + def edit_post_path(post, *args) + edit_me_discussion_post_path(@recipient, post, *args) + end + helper_method :edit_post_path + + def post_path(post, *args) + me_discussion_post_path(@recipient, post, *args) + end + helper_method :post_path + + def posts_path(*args) + me_discussion_posts_path(@recipient, *args) end + helper_method :posts_path end diff --git a/app/controllers/me/profile_controller.rb b/app/controllers/me/profile_controller.rb index 61783c4842b3f8616c89d6c8e3efca92db2c0087..8d5be5ce020b9643d8e3644fbf69857b7e926de5 100644 --- a/app/controllers/me/profile_controller.rb +++ b/app/controllers/me/profile_controller.rb @@ -1,6 +1,7 @@ class Me::ProfileController < Me::BaseController before_filter :fetch_profile + helper :profile def edit end diff --git a/app/controllers/pages/assets_controller.rb b/app/controllers/pages/assets_controller.rb index 05e78f94cac8dd9eaf2296c0f126eea73fc3038e..188dcca1cac637ac942414b4b6326fd0657e6464 100644 --- a/app/controllers/pages/assets_controller.rb +++ b/app/controllers/pages/assets_controller.rb @@ -22,7 +22,7 @@ class Pages::AssetsController < Pages::SidebarsController asset = Asset.find_by_id(params[:id]) asset.destroy respond_to do |format| - format.js {render :nothing => true } + format.js {render :text => 'if (initAjaxUpload) initAjaxUpload();' } format.html do #flash_message(:success => "attachment deleted") success ['attachment deleted'] diff --git a/app/controllers/pages/base_controller.rb b/app/controllers/pages/base_controller.rb index bd0636d7bfa311427bd9b889d6373f19037a0718..77676b37d71c572a011634728099b4efec0a94c0 100644 --- a/app/controllers/pages/base_controller.rb +++ b/app/controllers/pages/base_controller.rb @@ -9,14 +9,15 @@ class Pages::BaseController < ApplicationController layout 'page' permissions :pages guard :may_ACTION_page? + guard :update => :may_edit_page? javascript 'upload' stylesheet 'upload', 'gallery' # the page banner has links that the user cannot see when unauthorized, like membership. # so, we must load the appropriate permissions from groups. - permission_helper :posts, 'groups/memberships', 'groups/base' + permission_helper 'groups/memberships', 'groups/base' - helper 'pages/base', 'pages/sidebar' + helper 'pages/base', 'pages/sidebar', 'pages/post' ## ## FILTERS diff --git a/app/controllers/pages/posts_controller.rb b/app/controllers/pages/posts_controller.rb index 87b41e3483f642bb287951f1c16b76afd2673122..462fe79506e4cf9831876dab6bb2902271e4dd12 100644 --- a/app/controllers/pages/posts_controller.rb +++ b/app/controllers/pages/posts_controller.rb @@ -1,9 +1,13 @@ class Pages::PostsController < ApplicationController - permissions 'posts', 'pages' + include_controllers 'common/posts' + + permissions 'pages' + helper 'pages/post' + prepend_before_filter :fetch_data before_filter :login_required - guard :may_ALIAS_page_post? + guard :may_ALIAS_post? guard :show => :may_show_page? # if something goes wrong with create, redirect to the page url. @@ -19,23 +23,8 @@ class Pages::PostsController < ApplicationController def create @post = Post.create! @page, current_user, params[:post] current_user.updated(@page) - respond_to do |wants| - wants.html { redirect_to page_url(@page) } - # maybe? :anchor => @page.discussion.posts.last.dom_id), :paging => params[:paging] || '1') - wants.js { render :template => 'pages/posts/create' } - end - end - - def edit - end - - def update - if params[:save] - @post.update_attribute('body', params[:post][:body]) - elsif params[:destroy] - @post.destroy - return(render :action => 'destroy') - end + # maybe? :anchor => @page.discussion.posts.last.dom_id), :paging => params[:paging] || '1') + render_posts_refresh @page.posts(pagination_params) end # @@ -65,11 +54,9 @@ class Pages::PostsController < ApplicationController def fetch_data @page = Page.find(params[:page_id]) - @post = Post.find(params[:id], :include => :discussion) if params[:id] - if @post - if @post.discussion.page != @page - raise PermissionDenied - end + if params[:id] + @post = @page.discussion.posts.find(params[:id], :include => :discussion) + raise PermissionDenied.new unless @post end end diff --git a/app/controllers/pages/trash_controller.rb b/app/controllers/pages/trash_controller.rb index cd5199150774e1fb1817d1d7f21ff0a7f0435ee7..f88583f3b329e42dc5d2ba79c3e2245b9134d0c1 100644 --- a/app/controllers/pages/trash_controller.rb +++ b/app/controllers/pages/trash_controller.rb @@ -54,18 +54,5 @@ class Pages::TrashController < Pages::SidebarsController end helper_method :new_url - def authorized? - if action?(:update) - case params[:type] - when 'move_to_trash' then may_delete_page? - when 'undelete' then may_undelete_page? - when 'shred_now' then may_destroy_page? - when 'destroy' then may_destroy_page? - end - elsif action?(:edit) - may_delete_page? - end - end - end diff --git a/app/controllers/people/directory_controller.rb b/app/controllers/people/directory_controller.rb index 080c9a521672699d434e6c8ba68a83e7379db401..08d5bc77c65f6de193e3a1f1872f34bbd52accef 100644 --- a/app/controllers/people/directory_controller.rb +++ b/app/controllers/people/directory_controller.rb @@ -1,23 +1,28 @@ class People::DirectoryController < ApplicationController -# will need permissions, pagination, improved display + skip_before_filter :login_required + stylesheet 'directory' def index + @users = users_to_display.alphabetized(nil).paginate(pagination_params) + end + + protected + +# VIEW_KEYWORDS = ['friends', 'peers'] + + def users_to_display if !logged_in? - @users = User.with_access(:public => :view).paginate(pagination_params) + User.with_access(:public => :view) elsif friends? - @users = current_user.friends.paginate(pagination_params) + current_user.friends elsif peers? - @users = current_user.peers.paginate(pagination_params) + current_user.peers else - @users = User.with_access(current_user => :view).paginate(pagination_params) + User.with_access(current_user => :view) end end - protected - -# VIEW_KEYWORDS = ['friends', 'peers'] - def friends? params[:path].try.include? 'contacts' end @@ -25,5 +30,6 @@ class People::DirectoryController < ApplicationController def peers? params[:path].try.include? 'peers' end + end diff --git a/app/controllers/wikis/wikis_controller.rb b/app/controllers/wikis/wikis_controller.rb index 4e1deb219bbe5572dddd519cf4471209929c7923..b8a6d4479f6ff15686f9ef7e33a9e45e7e4731f3 100644 --- a/app/controllers/wikis/wikis_controller.rb +++ b/app/controllers/wikis/wikis_controller.rb @@ -51,7 +51,9 @@ class Wikis::WikisController < Wikis::BaseController @wiki.update_document!(current_user, params[:wiki][:version], params[:wiki][:body]) success end - redirect_to @page ? page_url(@page) : entity_path(@wiki.context) + redirect_to @page ? + page_url(@page) : + group_home_path(@wiki.context, :wiki_id => @wiki.id) rescue Wiki::VersionExistsError, Wiki::SectionLockedOnSaveError => exc warning exc diff --git a/app/helpers/common/page/post_helper.rb b/app/helpers/common/page/post_helper.rb index d08048b2d87edd5ffe6f6646fb8a320084f1bbb1..6e9d7b63de770688b4625b25b1b3382c7dc8f794 100644 --- a/app/helpers/common/page/post_helper.rb +++ b/app/helpers/common/page/post_helper.rb @@ -2,15 +2,17 @@ module Common::Page::PostHelper protected - # for now, no ajax pagination, even in responses from ajax requests. - def post_pagination_links(posts) + # + # klass should be 'first' or 'last' + # + def post_pagination_links(posts, klass) if posts.any? and posts.is_a?(WillPaginate::Collection) - color = cycle('shade_odd', 'shade_even') - content_tag(:tr, :class => color) do - content_tag(:td, :colspan => 2) do - will_paginate(posts, :param_name => 'posts', :renderer => LinkRenderer::Page, :previous_label => :pagination_previous.t, :next_label => :pagination_next.t) - end + if @page + param_name = 'posts' + else + param_name = 'page' end + will_paginate(posts, :class => "pagination p #{klass}", :param_name => param_name, :renderer => LinkRenderer::Page, :previous_label => :pagination_previous.t, :next_label => :pagination_next.t) end end diff --git a/app/helpers/common/ui/avatar_helper.rb b/app/helpers/common/ui/avatar_helper.rb index 7f5f049ed6500d8b2f4e69b7d21d520f2849bf2e..81394b6c0dae57547c925b5aa3dd4ecd0f4fe343 100644 --- a/app/helpers/common/ui/avatar_helper.rb +++ b/app/helpers/common/ui/avatar_helper.rb @@ -49,5 +49,15 @@ module Common::Ui::AvatarHelper ] end + def avatar_field(entity) + action = entity.avatar ? :edit : :new + context = (entity == current_user) ? :me : entity + url = polymorphic_path [context, entity.avatar || :avatar], + :action => action + link_options = {:url => url, :icon => 'picture_edit'} + + return avatar_for(entity,'large') + " " + + link_to_modal(:upload_image_link.t, link_options, :class => 'inline') + end end diff --git a/app/helpers/common/ui/post_helper.rb b/app/helpers/common/ui/post_helper.rb index 4018786d557d73a56079a71be4d822bd641c9925..8cc2b78703bf310cada5a5318825d4be1344c3f7 100644 --- a/app/helpers/common/ui/post_helper.rb +++ b/app/helpers/common/ui/post_helper.rb @@ -8,6 +8,16 @@ module Common::Ui::PostHelper link_to_function created_date, %Q[this.replace("#{detail_string}")], :class => 'dotted' end + # + # display the edit link for this post. + # sometimes, posts are not really posts. in this case, we skip the edit link. + # + def edit_post_link(post) + if post.is_a?(Post) && may_edit_post?(post) + link_to_remote :edit.t, {:url => edit_post_path(post), :method => 'get'}, {:class => 'shy', :icon => 'pencil'} + end + end + # def edit_post_action(post) # return unless may_edit_posts?(post) # content_tag :div, :class=>'post_action_icon' do diff --git a/app/helpers/common/utility/general_helper.rb b/app/helpers/common/utility/general_helper.rb index 71a15c1275b59cca563af092b466b7852e5a259d..b57f8d594034fb6b936cb0cfb055adbc59761c5f 100644 --- a/app/helpers/common/utility/general_helper.rb +++ b/app/helpers/common/utility/general_helper.rb @@ -119,12 +119,17 @@ module Common::Utility::GeneralHelper session[:logged_in_since] || Time.now end - # calls 'call' on proc if it really is a proc. - def safe_call(proc, *args) - if proc.is_a? Proc - proc.call(*args) + # + # if method is a proc or a symbol for a defined method, then it is called. + # otherwise, nothing happens. + # + def safe_call(method, *args) + if method.is_a? Proc + method.call(*args) + elsif method.is_a?(Symbol) && self.respond_to?(method) + send(method, *args) else - proc + false end end diff --git a/app/helpers/groups/links_helper.rb b/app/helpers/groups/links_helper.rb index 7dfb243b017192d4165ee13f4a8a451efeb2aaea..ab0303d2773a769ac56496539dbaea49f799d6f8 100644 --- a/app/helpers/groups/links_helper.rb +++ b/app/helpers/groups/links_helper.rb @@ -49,7 +49,7 @@ module Groups::LinksHelper group_my_membership_path(@group, current_user), :confirm => :leave_group_confirmation.t(:group_type => @group.group_type), :method => :delete, - :class => 'nav' + :class => 'navi' end end diff --git a/app/helpers/groups/settings_helper.rb b/app/helpers/groups/settings_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..b0e72437d1cefb66d879b2e866382438383c0680 --- /dev/null +++ b/app/helpers/groups/settings_helper.rb @@ -0,0 +1,39 @@ +module Groups::SettingsHelper + + def group_settings_form + formy(:table_form) do |f| + + f.heading :display.t + f.row do |r| + r.label :name.t + r.input text_field('group', 'name', :size => 40, :maxlength => 40) + r.info "(#{:required.t}) " + r.info :link_name_description.t + end + + f.row do |r| + r.label :display_name.t + r.label_for 'group_full_name' + r.input text_field('group', 'full_name', :size => 40, :maxlength => 100) + r.info "(#{:optional.t}) " + r.info I18n.t(:descriptive_name_for_display) + end + + f.row do |r| + r.label :icon.t + r.input avatar_field(@group) + end + + f.heading :locale.t + f.row do |r| + r.label :language.t + r.label_for 'group_language' + r.input select('group', 'language', all_languages_for_select, { :include_blank => true }) + end + + f.buttons submit_tag(:save_button.t, :class => 'btn btn-primary') + + end + end + +end diff --git a/app/helpers/groups/wikis_helper.rb b/app/helpers/groups/wikis_helper.rb index 61b305645b47b18b3a4006fcd3f67f98159b0263..4e07d644a0f9eec7ccff75d96c3ce4c9e8abd095 100644 --- a/app/helpers/groups/wikis_helper.rb +++ b/app/helpers/groups/wikis_helper.rb @@ -6,7 +6,7 @@ module Groups::WikisHelper def wiki_toggles formy(:toggle_bugs) do |f| - private_wiki_toggle(f) + private_wiki_toggle(f) if may_edit_group? public_wiki_toggle(f) end end diff --git a/app/helpers/link_renderer/ajax.rb b/app/helpers/link_renderer/ajax.rb index b7d95e8333c52469e19d9ac2b05773695fe396bd..5be47cedbe356686f23adb560ec776fd185ba336 100644 --- a/app/helpers/link_renderer/ajax.rb +++ b/app/helpers/link_renderer/ajax.rb @@ -4,18 +4,11 @@ # # class LinkRenderer::Ajax < LinkRenderer::CrabgrassBase - + def page_link_to(page, text, attributes = {}) - # ajax pagination will always use :get as the method - # because the action should be index (or possibly show) - options = { - :url => url_for(page), - :method => :get, - :loading => @template.show_spinner(spinner_id) - } - @template.link_to_remote(text, options, attributes) + @template.link_to_remote(text, link_options(page), attributes) end - + #def html_after # @template.spinner(spinner_id) #end @@ -26,5 +19,18 @@ class LinkRenderer::Ajax < LinkRenderer::CrabgrassBase 'pagination_' + @collection.first.class.name.underscore end + protected + + # overwritten by LinkRenderer::ModalAjax + def link_options(page) + # ajax pagination will always use :get as the method + # because the action should be index (or possibly show) + options = { + :url => url_for(page), + :method => :get, + :loading => @template.show_spinner(spinner_id) + } + end + end diff --git a/app/helpers/link_renderer/crabgrass_base.rb b/app/helpers/link_renderer/crabgrass_base.rb index c872d39d7efc1d5934be673fb9d590473a5da11d..0dde46de1caf084d14c72664ca7a9da44df96537 100644 --- a/app/helpers/link_renderer/crabgrass_base.rb +++ b/app/helpers/link_renderer/crabgrass_base.rb @@ -32,20 +32,20 @@ class LinkRenderer::CrabgrassBase < WillPaginate::LinkRenderer # # override the default to_html - # + # def to_html links = @options[:page_links] ? windowed_links : [] # previous/next buttons links.unshift page_link_or_span(@collection.previous_page, 'disabled prev_page', @options[:previous_label]) links.push page_link_or_span(@collection.next_page, 'disabled next_page', @options[:next_label]) - # links + # links links_html = links.join(@options[:separator]) links_html = links_html.html_safe if links_html.respond_to? :html_safe - @template.content_tag(:div, :class => 'pagination') do - html_before + @template.content_tag(:ul) do + @template.content_tag(:div, :class => @options[:class]) do + html_before + @template.content_tag(:ul) do links_html end + html_after - end + end end # may be overridden by subclasses diff --git a/app/helpers/me/settings_helper.rb b/app/helpers/me/settings_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..855cc052b8d823a7cefb01cb9973c40ab85e72ff --- /dev/null +++ b/app/helpers/me/settings_helper.rb @@ -0,0 +1,50 @@ +module Me::SettingsHelper + + def my_settings_form + formy(:table_form) do |f| + + f.heading :display.t + f.row do |r| + r.label :username.t + r.input text_field('user','login') + end + + f.row do |r| + r.label :display_name.t + r.input text_field('user','display_name') + end + + f.row do |r| + r.label :icon.t + r.input avatar_field(current_user) + end + + f.heading :notification.t + f.row do |r| + r.label :email.t + r.input text_field('user','email') + end + + ## TODO I18N: + f.row do |r| + r.label :notice.t + r.info :do_you_want_to_receive_email_notifications.t + r.input select('user', 'receive_notifications', [["No", ""], ["Yes: an email per change","Single"], ["Yes: just a summary email","Digest"]]) + end + + f.heading :locale.t + f.row do |r| + r.label :language.t + r.input select('user', 'language', all_languages_for_select, { :include_blank => true }) + end + + f.row do |r| + r.label :time_zone.t + r.input time_zone_select('user', 'time_zone', nil, :include_blank => true) + end + + f.buttons submit_tag(:save_button.t, :class => 'btn btn-primary') + end + end + +end diff --git a/app/helpers/pages/base_helper.rb b/app/helpers/pages/base_helper.rb index 606ca34c754cc550a7104dcbf5a1edcb3f686d1b..d925b9c42c1f847fbffc300362c0092e1cd1337d 100644 --- a/app/helpers/pages/base_helper.rb +++ b/app/helpers/pages/base_helper.rb @@ -5,6 +5,10 @@ module Pages::BaseHelper protected + ## + ## MISC HELPERS + ## + def page_tabs(options = {}) options.reverse_merge! :id => 'page_tabs', :class => 'flat reloadable' @@ -38,10 +42,6 @@ module Pages::BaseHelper ret << "</label>" end - ## - ## MISC HELPERS - ## - def this_page_class @page ? @page.class_display_name.capitalize : @page_class.class_display_name.capitalize end diff --git a/app/helpers/pages/post_helper.rb b/app/helpers/pages/post_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..25f53b3411f6ae109b6a3d0047d50b85ce138108 --- /dev/null +++ b/app/helpers/pages/post_helper.rb @@ -0,0 +1,25 @@ +module Pages::PostHelper + + protected + + ## + ## POST PATHS + ## + + # + # Define the path for editing posts. This is used by all the post templates. + # + + def edit_post_path(post, *args) + edit_page_post_path(@page, post, *args) + end + + def post_path(post, *args) + page_post_path(@page, post, *args) + end + + def posts_path(*args) + page_posts_path(@page, *args) + end + +end \ No newline at end of file diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..fb0e3f93f0a171fe61a4c4126661ba5e2b8fdd5a --- /dev/null +++ b/app/helpers/profile_helper.rb @@ -0,0 +1,27 @@ +module ProfileHelper + + def banner_field(formy) + formy.heading :banner.t + + if @profile.picture + formy.row do |r| + r.input clear_banner_input + end + else + formy.row do |r| + r.label I18n.t(:file) + r.label_for 'profile_picture_upload' + r.input file_field_tag('profile[picture][upload]', + :id => 'profile_picture_upload') + r.info :banner_info.t + end + end + end + + def clear_banner_input + [ picture_tag(@profile.picture, :medium), + submit_tag("Clear", :name => 'clear_photo') + ].join '<br/>' + end +end + diff --git a/app/helpers/wikis/base_helper.rb b/app/helpers/wikis/base_helper.rb index 43a366a968a101db99196f9e712ac03f4e4cc3f9..493b625bdcc616f5beb57c8feda3c48538dc78fd 100644 --- a/app/helpers/wikis/base_helper.rb +++ b/app/helpers/wikis/base_helper.rb @@ -12,6 +12,7 @@ module Wikis::BaseHelper t.function wiki_tab_function(wiki_path(wiki)) t.selected action?(:show) end + return unless may_edit_wiki?(wiki) formy.tab do |t| t.label :edit.t t.function wiki_tab_function(edit_wiki_path(wiki)) @@ -99,7 +100,7 @@ module Wikis::BaseHelper return unless @wiki.group return unless @wiki.try.body and @wiki.body.length > Wiki::PREVIEW_CHARS link_to_remote :see_more_link.t, - { :url => group_wiki_path(@group, @wiki), + { :url => wiki_path(@wiki), :method => :get}, :icon => 'plus' end @@ -108,7 +109,7 @@ module Wikis::BaseHelper return unless @wiki.group return unless @wiki.try.body and @wiki.body.length > Wiki::PREVIEW_CHARS link_to_remote :see_less_link.t, - { :url => group_wiki_path(@group, @wiki, :preview => true), + { :url => wiki_path(@wiki, :preview => true), :method => :get}, :icon => 'minus' end diff --git a/app/models/group.rb b/app/models/group.rb index ffdc8005a1f808aba85c5d192e85f1be820abe79..f69dcb085b34281240fe599907543b83aec7ce7e 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -75,7 +75,9 @@ class Group < ActiveRecord::Base named_scope :alphabetized, lambda { |letter| opts = { - :order => 'groups.full_name ASC, groups.name ASC' + # make sure this works with unset full_name as well as mixed case + # should work in both mysql and postgres + :order => 'LOWER(COALESCE(groups.full_name, groups.name)) ASC' } if letter == '#' diff --git a/app/models/user.rb b/app/models/user.rb index 03ca0fe5c8d10e9ab97da9eabc42825b85b89626..411ac32f90be574a577f0155538985489622658f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -49,7 +49,7 @@ class User < ActiveRecord::Base # alphabetized and (optional) limited to +letter+ named_scope :alphabetized, lambda {|letter| opts = { - :order => 'login ASC' + :order => 'LOWER(COALESCE(users.display_name, users.login)) ASC' } if letter == '#' opts[:conditions] = ['login REGEXP ?', "^[^a-z]"] diff --git a/app/permissions/me_permission.rb b/app/permissions/me_permission.rb index e7ea6eb3fb3033705909017251c0d948b11bd856..4df415153d9c00afa4d78da306819260a55c489d 100644 --- a/app/permissions/me_permission.rb +++ b/app/permissions/me_permission.rb @@ -7,4 +7,24 @@ module MePermission logged_in? end + ## + ## POSTS + ## + + def may_create_post? + current_user.may?(:pester, @recipient) + end + + def may_edit_post?(post=@post) + logged_in? and + post and + post.user_id == current_user.id + end + + alias_method :may_update_post?, :may_edit_post? + + def may_index_post? + true + end + end diff --git a/app/permissions/pages_permission.rb b/app/permissions/pages_permission.rb index 2c16a1e9976a173d1c28a4e0b1ef81bb3453b764..f2b8bcbc6dcf92ae804930021d05b321d4bb6c4d 100644 --- a/app/permissions/pages_permission.rb +++ b/app/permissions/pages_permission.rb @@ -28,9 +28,8 @@ module PagesPermission !page or may_admin_page? end - def may_destroy_page? - may_admin_page? - end + alias_method :may_destroy_page?, :may_admin_page? + alias_method :may_delete_page?, :may_edit_page? ## ## SHARING @@ -83,5 +82,34 @@ module PagesPermission end end + ## + ## POSTS + ## + + def may_create_post? + if !logged_in? + false + elsif current_user.may?(:edit, @page) + true + elsif current_user.may?(:view, @page) and @page.public_comments? + true + elsif @page.public and @page.public_comments? + false + end + end + + def may_edit_post?(post=@post) + logged_in? and + post and + post.user_id == current_user.id + end + + def may_twinkle_posts?(post=@post) + logged_in? and + post.discussion.page and + current_user.may?(:view, post.discussion.page) and + current_user.id != post.user_id + end + end diff --git a/app/permissions/posts_permission.rb b/app/permissions/posts_permission.rb deleted file mode 100644 index 03b69af583e01cf07494505977e5d46d84b07058..0000000000000000000000000000000000000000 --- a/app/permissions/posts_permission.rb +++ /dev/null @@ -1,30 +0,0 @@ -module PostsPermission - - protected - - def may_create_page_post? - if !logged_in? - false - elsif current_user.may?(:edit, @page) - true - elsif current_user.may?(:view, @page) and @page.public_comments? - true - elsif @page.public and @page.public_comments? - false - end - end - - def may_edit_page_post?(post=@post) - logged_in? and - post and - post.user == current_user - end - - def may_twinkle_posts?(post=@post) - logged_in? and - post.discussion.page and - current_user.may?(:view, post.discussion.page) and - current_user.id != post.user_id - end - -end diff --git a/app/stylesheets/as_needed/directory.scss b/app/stylesheets/as_needed/directory.scss index 03bd2424cc460c865e9ae7128ddd46f7300aae98..d705c0ecb06e054410abbb158721530223c056d1 100644 --- a/app/stylesheets/as_needed/directory.scss +++ b/app/stylesheets/as_needed/directory.scss @@ -9,7 +9,9 @@ float: left; } .text { - margin-left: $icon_medium + 7px + margin-left: $icon_medium + 7px; + // remove unnecessary scrollbar in ff + margin-bottom: 1px; } .info { font-style: italic; diff --git a/app/stylesheets/screen.scss b/app/stylesheets/screen.scss index b77b15dae486ee3fc38965c62a295b24b472e7f1..86b6d4e74101f48fae25208994d82b1e09cad007 100644 --- a/app/stylesheets/screen.scss +++ b/app/stylesheets/screen.scss @@ -55,6 +55,7 @@ @import "ui/borders"; @import "ui/modalbox"; @import "ui/posts"; +@import "ui/rows"; @import "ui/split_panel"; @import "ui/sliding_list"; // @import "ui/gizmos"; diff --git a/app/stylesheets/ui/posts.scss b/app/stylesheets/ui/posts.scss index c8261841fabb1d2ba56bb2857dd532a2bdbb5413..fc52b040a4534ad57f37cbd216053bc63af53c2a 100644 --- a/app/stylesheets/ui/posts.scss +++ b/app/stylesheets/ui/posts.scss @@ -23,9 +23,9 @@ background: $posts_odd_background; } .pagination { - border-bottom: $posts_border; - text-align: center; - padding: $posts_padding; + // border-bottom: $posts_border; + //text-align: center; + //padding: $posts_padding; } tr.post td { vertical-align: top; diff --git a/app/stylesheets/ui/typography.scss b/app/stylesheets/ui/typography.scss index 6c109b0e40c4379d74749fb5332c1ead2eaec9db..a8b09b84b11e577a4994ed36b2a668d08d8389b3 100644 --- a/app/stylesheets/ui/typography.scss +++ b/app/stylesheets/ui/typography.scss @@ -12,8 +12,8 @@ p, ol, ul, td, div { // supposed to contain blocks. Therefore, use this instead. .p { - margin-top: 1em; - margin-bottom: 1em; + margin-top: $grid_column_gutter; + margin-bottom: $grid_column_gutter; } // simulate a blockquote. diff --git a/app/stylesheets/ui/ui_elements.scss b/app/stylesheets/ui/ui_elements.scss index 8c3670a84ced0392e95c5c841325f39294f66184..9f3254f74c66f1c242b042992e70a7acd1a04583 100644 --- a/app/stylesheets/ui/ui_elements.scss +++ b/app/stylesheets/ui/ui_elements.scss @@ -49,33 +49,16 @@ opacity: 1; } -// -// PAGINATION -// - -//.pagination { -// a, span { -// padding: 0px 4px 2px 4px; -// } -// span.prev_page { -// padding-left: 0; -// } -// span.current { -// background-color: $link_standard_color; -// color: white; -// } -//} - // // TWO COLUMN FLOATED ITEMS -// +// // this allows us to display a bunch of items in two columns, but in a way such // that if the window gets too small to display the two columns it will collapse // gracefully to a single column. // // used like so: -// -// .two_column_float +// +// .two_column_float // .column_item= 'hi' // .column_item= 'there' // .column_item= 'stranger' diff --git a/app/stylesheets/ui/wiki.scss b/app/stylesheets/ui/wiki.scss index a11f2c245ad9529d7c8aa368aca5862c500725ef..14421908c3aca748d86758509fa62daa8044e97b 100644 --- a/app/stylesheets/ui/wiki.scss +++ b/app/stylesheets/ui/wiki.scss @@ -1,5 +1,7 @@ .wiki, .post { + overflow: auto; + // // CODE BLOCKS diff --git a/app/views/common/posts/_list.html.haml b/app/views/common/posts/_list.html.haml index a6375dcbf8628be607ad95c694ac996dd8151ea8..f5671d4e54094712027061334d7460de31afbc64 100644 --- a/app/views/common/posts/_list.html.haml +++ b/app/views/common/posts/_list.html.haml @@ -5,16 +5,20 @@ -# style -- currently, only 'table' -# posts -- the array of Post objects. -# --# requires: --# create_url -- the url to post the create post form to. --# if missing or false, no reply is possible. +-# these paths must be defined: -# --# optional: --# edit_url -- url for editing an old post. +-# edit_post_path(post, *args) -- path for editing post. +-# post_path(post, *args) -- path for updating the post. +-# posts_path(*args) -- path to create a post. +-# +-# these permissions must be defined: +-# may_create_post?() +-# may_edit_post?(post) -# - style = local_assigns[:style] ||= :table - posts = local_assigns[:posts] ||= @posts +- local_assigns[:remote] = true if local_assigns[:remote].nil? %section{:class => "post_list #{style}", :id => 'posts'} = render :partial => "/common/posts/list_as_#{style}", :locals => local_assigns diff --git a/app/views/common/posts/_list_as_table.html.haml b/app/views/common/posts/_list_as_table.html.haml index b24b127dc2e1bee752443cf73cff48fea48ec251..7b88618518e952c411a5fc0cb8f494339bd24977 100644 --- a/app/views/common/posts/_list_as_table.html.haml +++ b/app/views/common/posts/_list_as_table.html.haml @@ -1,23 +1,23 @@ -# --# display a list of posts, using a table. +-# display a list of posts, using a table. -# -# the table uses funky spacer rows, but this makes it possible to have a full -# height divider border between the user avatar and the body of the post, -# regardless of which side is taller. --# +-# - local_assigns[:reply_body] ||= false -- show_reply = local_assigns[:create_url] || local_assigns[:reply_body] || false +- show_reply = local_assigns[:reply_body] || safe_call(:may_create_post?) || false - if posts.any? - last_id = posts.last.id - else - last_id = nil += post_pagination_links(posts, 'first') %table.posts.round - = post_pagination_links(posts) - for post in posts do = render :partial => 'common/posts/table/row', :locals => local_assigns.merge(:post => post, :last => (post.id == last_id)) - = post_pagination_links(posts) - if show_reply = render :partial => 'common/posts/table/reply', :locals => local_assigns.merge(:last_id => last_id) += post_pagination_links(posts, 'last') diff --git a/app/views/common/posts/table/_body.html.haml b/app/views/common/posts/table/_body.html.haml index 555374ad2a320fe1387d6150d0594e1a204b0c52..f26083fa236410a35deafc20e68509f1aa6fe89c 100644 --- a/app/views/common/posts/table/_body.html.haml +++ b/app/views/common/posts/table/_body.html.haml @@ -4,10 +4,7 @@ %div.post_body.shy_parent{:id => post.body_id} %div.float_right - - if local_assigns[:edit_url] - - url = safe_call(edit_url, post) - = link_to_remote :edit.t, {:url => url}, {:class => 'shy', :icon => 'pencil'} - = #edit_post_action(post) + = edit_post_link(post) = #star_post_action(post) = # call_hook :post_actions, {:post => post} = post.body_html diff --git a/app/views/common/posts/table/_edit.html.haml b/app/views/common/posts/table/_edit.html.haml index 2704592dacabedde79f29de0487ed0ac968db112..64c0b0036e0103aa501884af0f30b81a04ede92c 100644 --- a/app/views/common/posts/table/_edit.html.haml +++ b/app/views/common/posts/table/_edit.html.haml @@ -1,9 +1,11 @@ +-# -# requires: --# url -# post +-# post_path must be defined. +-# %div.post_body{:id => post.body_id} - - remote_form_for(:post, post, :url => url, :method => :put, :loading => show_spinner('edit_post')) do |f| + - remote_form_for(:post, post, :url => post_path(post), :method => :put, :loading => show_spinner('edit_post')) do |f| = f.text_area :body, :rows => 8 .buttons = spinner('edit_post') diff --git a/app/views/common/posts/table/_reply_body.html.haml b/app/views/common/posts/table/_reply_body.html.haml index 0db994f6c5fcc5cda23faedd39a9d2f90fad53ca..0df9702417907d0a870da640b0a7323df18b3af0 100644 --- a/app/views/common/posts/table/_reply_body.html.haml +++ b/app/views/common/posts/table/_reply_body.html.haml @@ -1,6 +1,7 @@ -# -# requires: --# create_url -- url to send the action to +-# posts_path(*arg) -- must be defined, for creating. +-# -# options: -# last_id -- set in_reply_to_id, which currently is just used for helping -# to generate the activity feed. @@ -9,7 +10,7 @@ - remote = local_assigns[:remote] || false - form = remote ? method(:remote_form_for) : method(:form_for) -- form.call(:post, @post, :url => create_url, :loading => show_spinner('post')) do |f| +- form.call(:post, @post, :url => posts_path, :loading => show_spinner('post')) do |f| = hidden_field_tag('in_reply_to_id', last_id) if last_id -# not sure if these are still used, or how they are used: diff --git a/app/views/groups/directory/_group.html.haml b/app/views/groups/directory/_group.html.haml index c9f74340b2536688f2e0037040b6502b364e85ba..c8748c7450f383cfa446347677faf742e4c3c4ba 100644 --- a/app/views/groups/directory/_group.html.haml +++ b/app/views/groups/directory/_group.html.haml @@ -1,4 +1,4 @@ -.entry +.entry.span4 .avatar= avatar_link(group, 'medium') .text = group_entry(group) diff --git a/app/views/groups/directory/index.html.haml b/app/views/groups/directory/index.html.haml index b0cad97f597ba9a9e346183cf16f4e218dc5aa14..10bf7c1c5308099ef271ab92d317d4cc1862ac60 100644 --- a/app/views/groups/directory/index.html.haml +++ b/app/views/groups/directory/index.html.haml @@ -3,14 +3,10 @@ -# .column_item -# = render :partial => 'group', :locals => {:group => group} -- groups_a, groups_b = even_split(@groups) -.directory.split_panel - .panel_left - = render :partial => 'group', :collection => groups_a - .panel_right - = render :partial => 'group', :collection => groups_b - - +.directory.grid + - @groups.in_groups_of(2, false) do |pair| + .row + = render :partial => 'group', :collection => pair .p = pagination_links(@groups) diff --git a/app/views/groups/home/_wikis.html.haml b/app/views/groups/home/_wikis.html.haml index e47a3319e85efb8c87070ae161e98c441255b5aa..a3e0de5eafb10c29401b7b4389a8e8a93b802008 100644 --- a/app/views/groups/home/_wikis.html.haml +++ b/app/views/groups/home/_wikis.html.haml @@ -1,14 +1,8 @@ -- if current_user.member_of? @group - .pull-right - = wiki_toggles - %h2= :group_wiki.t - .clear - = wiki_with_tabs(@private_wiki) - = wiki_with_tabs(@public_wiki) - - if !@private_wiki || !@public_wiki - #new_wiki.tab_content -- elsif @wiki - %div[@wiki] - -# show full wiki not preview: - = render :partial => 'common/wiki/show' - = spinner(@wiki) +.pull-right + = wiki_toggles +%h2= :group_wiki.t +.clear + = wiki_with_tabs(@private_wiki) + = wiki_with_tabs(@public_wiki || @wiki) + - if may_edit_group? && ( !@private_wiki || !@public_wiki ) + #new_wiki.tab_content diff --git a/app/views/groups/home/reload.rjs b/app/views/groups/home/reload.rjs new file mode 100644 index 0000000000000000000000000000000000000000..bed8929f06efdeca20b2acac535b7aacc64e53d1 --- /dev/null +++ b/app/views/groups/home/reload.rjs @@ -0,0 +1 @@ +page.redirect_to(group_home_url(@group)) diff --git a/app/views/groups/profiles/edit.html.haml b/app/views/groups/profiles/edit.html.haml index a000eb796c7ebbbbb5f35c1a84aff42bbbff1c03..e2e89f1d1e4c3a4f11d40b015b0d8c984260d7eb 100644 --- a/app/views/groups/profiles/edit.html.haml +++ b/app/views/groups/profiles/edit.html.haml @@ -14,23 +14,6 @@ - r.label "%s (%s)" % [:summary.tcap, :preview.t] - r.input @profile.summary_html - - f.heading :photo.t - - if @profile.picture - - f.row do |r| - - r.input [picture_tag(@profile.picture, :medium), submit_tag("Clear", :name => 'clear_photo')].join('<br/>') - - else - - f.row do |r| - - r.label I18n.t(:file) - - r.label_for 'profile_picture_upload' - - r.input file_field_tag('profile[picture][upload]', :id => 'profile_picture_upload') - - f.row do |r| - - r.label I18n.t(:caption) - - r.label_for 'profile_picture_caption' - - r.input text_field_tag('profile[picture][caption]', '', :id => 'profile_picture_caption') - - f.row do |r| - - r.label I18n.t(:photo_credit) - - r.label_for 'profile_picture_picture' - - r.input text_field_tag('profile[picture][credit]', '', :id => 'profile_picture_credit') - + - banner_field(f) - f.buttons submit_tag(:save_button.t, :name => 'save') diff --git a/app/views/groups/settings/_form.html.haml b/app/views/groups/settings/_form.html.haml deleted file mode 100644 index e8934619d29a71b243bb844e469e5c8a8f92f687..0000000000000000000000000000000000000000 --- a/app/views/groups/settings/_form.html.haml +++ /dev/null @@ -1,33 +0,0 @@ --# --# requires: form --# - -= formy(:table_form) do |f| - - - f.row do |r| - - r.label :icon.t - - r.input content_tag(:div, avatar_for(@group, 'xlarge'), :class => 'float_left') - - r.input content_tag(:div, edit_avatar_link, :class => 'float_left', :style => 'margin-left: 1em') - - r.info "" - - - f.row do |r| - - r.label :name.t - - r.input text_field('group', 'name', :size => 40, :maxlength => 40) - - r.info "(#{:required.t}) " - - r.info :link_name_description.t - - - f.row do |r| - - r.label :display_name.t - - r.label_for 'group_full_name' - - r.input text_field('group', 'full_name', :size => 40, :maxlength => 100) - - r.info "(#{:optional.t}) " - - r.info I18n.t(:descriptive_name_for_display) - - - f.row do |r| - - r.label I18n.t(:language) - - r.label_for 'group_language' - - r.input select('group', 'language', all_languages_for_select, {:include_blank => true}) - - r.info "(#{:optional.t}) " - - r.info :group_language.t(:group => group_type.t.downcase) - - - f.buttons submit_tag(:save_button.t) diff --git a/app/views/groups/settings/show.html.haml b/app/views/groups/settings/show.html.haml index 842dc17d451c5cea8df373f8909a7c046d0cdce2..0bb699ac75f7b57025918034a61c1d103f62abe2 100644 --- a/app/views/groups/settings/show.html.haml +++ b/app/views/groups/settings/show.html.haml @@ -1,4 +1,3 @@ - form_tag(group_settings_path(@group), :method => 'put') do - = render :partial => '/groups/settings/form' - + = group_settings_form diff --git a/app/views/layouts/local/page/_content.html.haml b/app/views/layouts/local/page/_content.html.haml index 432dffde513f63e48f9dd6ccb8b70bd1d14fb57d..27d5dcff663f44dc5fb5ba3a0a43e7f57ba44521 100644 --- a/app/views/layouts/local/page/_content.html.haml +++ b/app/views/layouts/local/page/_content.html.haml @@ -5,9 +5,5 @@ %article#content.round-bottom = yield - if @options.show_posts - = render :partial => 'common/posts/list', - :locals => {:style => 'table', - :remote => true, - :create_url => may_create_page_post? ? page_posts_path(@page) : false, - :edit_url => lambda{|post| edit_page_post_path(@page, post)}} + = render :partial => 'common/posts/list', :locals => {:style => 'table', :remote => true} diff --git a/app/views/me/posts/index.html.haml b/app/views/me/posts/index.html.haml index 4a2051445add0272d47b616d4c5611b508c3f573..0db62d45794561a1f2fee636db18cacd99a59f88 100644 --- a/app/views/me/posts/index.html.haml +++ b/app/views/me/posts/index.html.haml @@ -1,8 +1,17 @@ - content_for :dom_loaded do = "$('post_reply').scrollToBottom();" -%heading.title - %h2 - = :messages_with.t(:other_user => link_to_user(@other_user)) +- content_for :title do + .h1= link_to_user(@recipient, :avatar => 'medium') -= render :partial => 'common/posts/list', :locals => {:posts => @posts, :create_url => me_discussion_posts_path(@other_user)} +-# %ul.breadcrumb +-# %li +-# = link_to :me.t, me_path +-# %span.divider / +-# %li +-# = link_to :messages.t, me_discussions_path +-# %span.divider / +-# %li +-# = link_to_user(@recipient, :avatar => 'tiny') + += render :partial => 'common/posts/list', :locals => {:posts => @posts} diff --git a/app/views/me/profile/edit.html.haml b/app/views/me/profile/edit.html.haml index 25058576dfbb4ccb786192902fa98515eacbd6db..ee29badaec7818d09dc218110cd994e9f69905f7 100644 --- a/app/views/me/profile/edit.html.haml +++ b/app/views/me/profile/edit.html.haml @@ -19,24 +19,7 @@ - r.label "%s (%s)" % [:summary.tcap, :preview.t] - r.input @profile.summary_html - - f.heading :photo.t - - if @profile.picture - - f.row do |r| - - r.input [picture_tag(@profile.picture, :medium), submit_tag("Clear", :name => 'clear_photo')].join('<br/>') - - else - - f.row do |r| - - r.label I18n.t(:file) - - r.label_for 'profile_picture_upload' - - r.input file_field_tag('profile[picture][upload]', :id => 'profile_picture_upload') - - f.row do |r| - - r.label I18n.t(:caption) - - r.label_for 'profile_picture_caption' - - r.input text_field_tag('profile[picture][caption]', '', :id => 'profile_picture_caption') - - f.row do |r| - - r.label I18n.t(:photo_credit) - - r.label_for 'profile_picture_picture' - - r.input text_field_tag('profile[picture][credit]', '', :id => 'profile_picture_credit') - + - banner_field(f) - f.buttons submit_tag(:save_button.t, :name => 'save') diff --git a/app/views/me/settings/_form.html.erb b/app/views/me/settings/_form.html.erb deleted file mode 100644 index 6150b0f8be3f9f1b00f5a9a111fdb6b38a39e570..0000000000000000000000000000000000000000 --- a/app/views/me/settings/_form.html.erb +++ /dev/null @@ -1,51 +0,0 @@ -<% -url = current_user.avatar ? edit_me_avatar_path(current_user.avatar) : new_me_avatar_path -avatar_form = avatar_for(current_user,'large') + " " + link_to_modal(:upload_image_link.t, {:url => url, :icon => -'picture_edit'}, :class => 'inline') --%> -<%= formy(:table_form) do |f| - - f.heading :display.t - f.row do |r| - r.label :username.t - r.input text_field('user','login') - end - - f.row do |r| - r.label :display_name.t - r.input text_field('user','display_name') - end - - f.row do |r| - r.label :icon.t - r.input avatar_form - end - - f.heading :notification.t - f.row do |r| - r.label :email.t - r.input text_field('user','email') - end - - ## TODO I18N: - f.row do |r| - r.label :notice.t - r.info :do_you_want_to_receive_email_notifications.t - r.input select('user', 'receive_notifications', [["No", ""], ["Yes: an email per change","Single"], ["Yes: just a summary email","Digest"]]) - end - - f.heading :locale.t - f.row do |r| - r.label :language.t - r.input select('user', 'language', all_languages_for_select, { :include_blank => true }) - end - - f.row do |r| - r.label :time_zone.t - r.input time_zone_select('user', 'time_zone', nil, :include_blank => true) - end - - f.buttons submit_tag(:save_button.t, :class => 'btn btn-primary') - -end %> - diff --git a/app/views/me/settings/show.html.haml b/app/views/me/settings/show.html.haml index 06c71aa94a17bc7ab1bde8e48920fd6302e80fab..c7e1cebd42efc6cd182f77cfd626e6c674c753b0 100644 --- a/app/views/me/settings/show.html.haml +++ b/app/views/me/settings/show.html.haml @@ -6,6 +6,4 @@ .form - form_tag(me_settings_path, :method => :put) do - = render :partial => '/me/settings/form' - - + = my_settings_form diff --git a/app/views/pages/posts/create.rjs b/app/views/pages/posts/create.rjs deleted file mode 100644 index dcd931d4efc29bd43803f5c2549d724bd98b2dc1..0000000000000000000000000000000000000000 --- a/app/views/pages/posts/create.rjs +++ /dev/null @@ -1,18 +0,0 @@ -# -# we just simply refresh the entire local section of the layout. who knows -# what might have changed since we first loaded the page? -# - -@post = Post.new # for the reply form -@posts = @page.posts # this is throwing a nil error - -page.replace('posts', - :partial => 'common/posts/list', - :locals => { - :style => 'table', - :remote => true, - :create_url => page_posts_path(@page), - :edit_url => lambda{|post| edit_page_post_path(@page, post)} - } -) - diff --git a/app/views/pages/posts/destroy.rjs b/app/views/pages/posts/destroy.rjs deleted file mode 100644 index 84b9a90f83e5a4fe666bbe0256360f2faa29e3f5..0000000000000000000000000000000000000000 --- a/app/views/pages/posts/destroy.rjs +++ /dev/null @@ -1 +0,0 @@ -page.hide @post.dom_id diff --git a/app/views/pages/posts/edit.rjs b/app/views/pages/posts/edit.rjs deleted file mode 100644 index 42d928a167791720c79e1a6377453c542cbf4177..0000000000000000000000000000000000000000 --- a/app/views/pages/posts/edit.rjs +++ /dev/null @@ -1,8 +0,0 @@ -page.replace( - @post.body_id, - :partial => 'common/posts/table/edit', - :locals => { - :post => @post, - :url => page_post_path(@page, @post) - } -) diff --git a/app/views/pages/posts/update.rjs b/app/views/pages/posts/update.rjs deleted file mode 100644 index b39550ef7beee094cae8e61c4a70dcb46c1698b5..0000000000000000000000000000000000000000 --- a/app/views/pages/posts/update.rjs +++ /dev/null @@ -1,9 +0,0 @@ -page.replace( - @post.body_id, - :partial => 'common/posts/table/body', - :locals => { - :post => @post, - :edit_url => edit_page_post_path(@page, @post) - } -) - diff --git a/app/views/people/directory/index.html.haml b/app/views/people/directory/index.html.haml index 51680c4c2e036ad9bbbe319f76f423f1d747ec86..7c2f205327a9d49345f8d0118409cf7da9d78e4a 100644 --- a/app/views/people/directory/index.html.haml +++ b/app/views/people/directory/index.html.haml @@ -1 +1,9 @@ -= render :partial => "common/entities/two_column", :locals => {:entities => @users, :entity_partial => 'common/entities/directory_entry'} +.directory.grid + - @users.in_groups_of(2, false) do |pair| + .row + = render :partial => 'user', :collection => pair +.p + = pagination_links(@users) + + + diff --git a/config/environment.rb b/config/environment.rb index 7c0710cbabbbc5533cdebb846e57d6383c1ad264..cd8e415ce2ff0a9a32a425f5250f771fe0cb33bb 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -35,16 +35,23 @@ Crabgrass::Initializer.run do |config| config.time_zone = 'UTC' config.active_record.default_timezone = :utc - # allow plugins in more places - [CRABGRASS_PLUGINS_DIRECTORY, MODS_DIRECTORY, PAGES_DIRECTORY, WIDGETS_DIRECTORY].each do |path| - config.plugin_paths << path - end - # Deliveries are disabled by default. Do NOT modify this section. # Define your email configuration in email.yml instead. # It will automatically turn deliveries on config.action_mailer.perform_deliveries = false + ## + ## PLUGINS + ## + + # we must load crabgrass_mods and load_model_callback first. + config.plugins = [:crabgrass_mods, :after_reload, :all] + + # allow plugins in more places + [CRABGRASS_PLUGINS_DIRECTORY, MODS_DIRECTORY, PAGES_DIRECTORY, WIDGETS_DIRECTORY].each do |path| + config.plugin_paths << path + end + ## ## GEMS ## see environments/test.rb for testing specific gems diff --git a/config/locales/en/profiles.yml b/config/locales/en/profiles.yml index 9d45dfd6e449b2a44be6fc31d9ce87ecde0a313c..7220c6db75a00593440bd3405ae2b3ee474260ce 100644 --- a/config/locales/en/profiles.yml +++ b/config/locales/en/profiles.yml @@ -4,6 +4,8 @@ en: ##! profile_last_login: "Last Login" profile_member_since: "Member Since" home: Home + banner: Banner + banner_info: Optimal dimenssions are 872 x 100 pixels ##! work: Work ##! school: School ##! personal: Personal diff --git a/config/locales/en/unsorted.yml b/config/locales/en/unsorted.yml index 183ef17ef9722ab70d7fde478cb3fb21ba521dec..3c4572e7f3d026388fd91d290cd1a0039390e2db 100644 --- a/config/locales/en/unsorted.yml +++ b/config/locales/en/unsorted.yml @@ -306,11 +306,12 @@ en: top_pick: "top pick" first_choice_of: "first choice of" - ##! vote_good: "good" - ##! vote_ok: "ok" - ##! vote_bad: "bad" - ##! vote_none: "none" - ##! vote_no: "no" + vote_good: "good" + vote_ok: "ok" + vote_bad: "bad" + vote_none: "none" + vote_no: "no" + ## ## SURVEY PAGE ## diff --git a/config/permissions.rb b/config/permissions.rb index 6cb5b052a9eca416d5dcc2ceefd7545ff645a7e0..5763f2a119cf83b8b6d19407acae1746cbfe32aa 100644 --- a/config/permissions.rb +++ b/config/permissions.rb @@ -20,7 +20,9 @@ # comment -- post a comment to the entity's public message board # -class Permissions < CastleGates::Permissions +CastleGates.exception_class = PermissionDenied + +CastleGates.define do holder 0, :public, :label => :public, diff --git a/doc/routes.txt b/doc/routes.txt index 5c6f907c71910de1418687517a965ae1097f0e12..6d87a4b3a904ea1645f86a4fb1e133baae6e7b84 100644 --- a/doc/routes.txt +++ b/doc/routes.txt @@ -1,291 +1,230 @@ -(in /home/elijah/dev/crabgrass/crabgrass-core) --- LOAD GEMS ------------------------------------------------------------------- --- LOAD PLUGINS ---------------------------------------------------------------- --- skipping transmogrifier DismodTransmogrifier, requirements not met ---------- --- LOAD GEMS ------------------------------------------------------------------- --- LOAD INITIALIZERS ----------------------------------------------------------- --- LOAD VIEW PATHS ------------------------------------------------------------- --- LOAD APPLICATION CLASSES ---------------------------------------------------- --- DONE LOADING ---------------------------------------------------------------- - create_asset /assets/create/:id {:action=>"create", :controller=>"assets"} - destroy_asset /assets/destroy/:id {:action=>"destroy", :controller=>"assets"} - asset_version /assets/:id/versions/:version/:path {:action=>"show", :controller=>"assets"} - asset /assets/:id/:path {:action=>"show", :controller=>"assets"} - avatar /avatars/:id/:size.jpg {:action=>"show", :controller=>"avatars"} - /theme/:name/:file.css {:action=>"show", :controller=>"theme"} - pictures /pictures/:id1/:id2/:geometry(.:format) {:action=>"show", :controller=>"pictures"} - me_notices GET /me/notices(.:format) {:action=>"index", :controller=>"me/notices"} - POST /me/notices(.:format) {:action=>"create", :controller=>"me/notices"} - new_me_notice GET /me/notices/new(.:format) {:action=>"new", :controller=>"me/notices"} - edit_me_notice GET /me/notices/:id/edit(.:format) {:action=>"edit", :controller=>"me/notices"} - me_notice GET /me/notices/:id(.:format) {:action=>"show", :controller=>"me/notices"} - PUT /me/notices/:id(.:format) {:action=>"update", :controller=>"me/notices"} - DELETE /me/notices/:id(.:format) {:action=>"destroy", :controller=>"me/notices"} - me_home /me {:action=>"index", :controller=>"me/notices"} - new_me_page GET /me/page/new(.:format) {:action=>"new", :controller=>"me/pages"} - me_page POST /me/page(.:format) {:action=>"create", :controller=>"me/pages"} - me_pages /me/pages/:path {:action=>"index", :controller=>"me/pages"} - me_activities GET /me/activities(.:format) {:action=>"index", :controller=>"me/activities"} - POST /me/activities(.:format) {:action=>"create", :controller=>"me/activities"} - new_me_activity GET /me/activities/new(.:format) {:action=>"new", :controller=>"me/activities"} - edit_me_activity GET /me/activities/:id/edit(.:format) {:action=>"edit", :controller=>"me/activities"} - me_activity GET /me/activities/:id(.:format) {:action=>"show", :controller=>"me/activities"} - PUT /me/activities/:id(.:format) {:action=>"update", :controller=>"me/activities"} - DELETE /me/activities/:id(.:format) {:action=>"destroy", :controller=>"me/activities"} - me_discussion_posts GET /me/messages/:discussion_id/posts(.:format) {:action=>"index", :controller=>"me/posts"} - POST /me/messages/:discussion_id/posts(.:format) {:action=>"create", :controller=>"me/posts"} - new_me_discussion_post GET /me/messages/:discussion_id/posts/new(.:format) {:action=>"new", :controller=>"me/posts"} - edit_me_discussion_post GET /me/messages/:discussion_id/posts/:id/edit(.:format) {:action=>"edit", :controller=>"me/posts"} - me_discussion_post GET /me/messages/:discussion_id/posts/:id(.:format) {:action=>"show", :controller=>"me/posts"} - PUT /me/messages/:discussion_id/posts/:id(.:format) {:action=>"update", :controller=>"me/posts"} - DELETE /me/messages/:discussion_id/posts/:id(.:format) {:action=>"destroy", :controller=>"me/posts"} - me_discussions GET /me/messages(.:format) {:action=>"index", :controller=>"me/discussions"} - POST /me/messages(.:format) {:action=>"create", :controller=>"me/discussions"} - new_me_discussion GET /me/messages/new(.:format) {:action=>"new", :controller=>"me/discussions"} - edit_me_discussion GET /me/messages/:id/edit(.:format) {:action=>"edit", :controller=>"me/discussions"} - me_discussion GET /me/messages/:id(.:format) {:action=>"show", :controller=>"me/discussions"} - PUT /me/messages/:id(.:format) {:action=>"update", :controller=>"me/discussions"} - DELETE /me/messages/:id(.:format) {:action=>"destroy", :controller=>"me/discussions"} - me_settings GET /me/settings(.:format) {:action=>"show", :controller=>"me/settings"} - PUT /me/settings(.:format) {:action=>"update", :controller=>"me/settings"} - me_permissions GET /me/permissions(.:format) {:action=>"index", :controller=>"me/permissions"} - POST /me/permissions(.:format) {:action=>"create", :controller=>"me/permissions"} - new_me_permission GET /me/permissions/new(.:format) {:action=>"new", :controller=>"me/permissions"} - edit_me_permission GET /me/permissions/:id/edit(.:format) {:action=>"edit", :controller=>"me/permissions"} - me_permission GET /me/permissions/:id(.:format) {:action=>"show", :controller=>"me/permissions"} - PUT /me/permissions/:id(.:format) {:action=>"update", :controller=>"me/permissions"} - DELETE /me/permissions/:id(.:format) {:action=>"destroy", :controller=>"me/permissions"} - edit_me_profile GET /me/profile/edit(.:format) {:action=>"edit", :controller=>"me/profile"} - me_profile PUT /me/profile(.:format) {:action=>"update", :controller=>"me/profile"} - me_requests GET /me/requests(.:format) {:action=>"index", :controller=>"me/requests"} - POST /me/requests(.:format) {:action=>"create", :controller=>"me/requests"} - new_me_request GET /me/requests/new(.:format) {:action=>"new", :controller=>"me/requests"} - edit_me_request GET /me/requests/:id/edit(.:format) {:action=>"edit", :controller=>"me/requests"} - me_request GET /me/requests/:id(.:format) {:action=>"show", :controller=>"me/requests"} - PUT /me/requests/:id(.:format) {:action=>"update", :controller=>"me/requests"} - DELETE /me/requests/:id(.:format) {:action=>"destroy", :controller=>"me/requests"} - me_events GET /me/events(.:format) {:action=>"index", :controller=>"me/events"} - POST /me/events(.:format) {:action=>"create", :controller=>"me/events"} - new_me_event GET /me/events/new(.:format) {:action=>"new", :controller=>"me/events"} - edit_me_event GET /me/events/:id/edit(.:format) {:action=>"edit", :controller=>"me/events"} - me_event GET /me/events/:id(.:format) {:action=>"show", :controller=>"me/events"} - PUT /me/events/:id(.:format) {:action=>"update", :controller=>"me/events"} - DELETE /me/events/:id(.:format) {:action=>"destroy", :controller=>"me/events"} - me_avatars GET /me/avatars(.:format) {:action=>"index", :controller=>"me/avatars"} - POST /me/avatars(.:format) {:action=>"create", :controller=>"me/avatars"} - new_me_avatar GET /me/avatars/new(.:format) {:action=>"new", :controller=>"me/avatars"} - edit_me_avatar GET /me/avatars/:id/edit(.:format) {:action=>"edit", :controller=>"me/avatars"} - me_avatar GET /me/avatars/:id(.:format) {:action=>"show", :controller=>"me/avatars"} - PUT /me/avatars/:id(.:format) {:action=>"update", :controller=>"me/avatars"} - DELETE /me/avatars/:id(.:format) {:action=>"destroy", :controller=>"me/avatars"} - reset_password /account/reset_password/:token {:action=>"reset_password", :controller=>"account"} - verify_account /account/verify_email/:token {:action=>"verify_email", :controller=>"account"} - new_account /account/new {:action=>"new", :controller=>"account"} - account /account/:action/:id {:controller=>"account"} - language /session/language {:action=>"language", :controller=>"session"} - login /session/login {:action=>"login", :controller=>"session"} - logout /session/logout {:action=>"logout", :controller=>"session"} - session /session/:action/:id {:controller=>"session"} - entities GET /entities(.:format) {:action=>"index", :controller=>"entities"} - people_directory /people/directory/:path {:action=>"index", :controller=>"people/directory"} - person_home GET /people/:person_id/home(.:format) {:action=>"show", :controller=>"people/homes"} - person_pages /people/:person_id/pages/:path {:action=>"index", :controller=>"people/pages"} - person_messages GET /people/:person_id/messages(.:format) {:action=>"index", :controller=>"people/messages"} - POST /people/:person_id/messages(.:format) {:action=>"create", :controller=>"people/messages"} - new_person_message GET /people/:person_id/messages/new(.:format) {:action=>"new", :controller=>"people/messages"} - edit_person_message GET /people/:person_id/messages/:id/edit(.:format) {:action=>"edit", :controller=>"people/messages"} - person_message GET /people/:person_id/messages/:id(.:format) {:action=>"show", :controller=>"people/messages"} - PUT /people/:person_id/messages/:id(.:format) {:action=>"update", :controller=>"people/messages"} - DELETE /people/:person_id/messages/:id(.:format) {:action=>"destroy", :controller=>"people/messages"} - person_activities GET /people/:person_id/activities(.:format) {:action=>"index", :controller=>"people/activities"} - POST /people/:person_id/activities(.:format) {:action=>"create", :controller=>"people/activities"} - new_person_activity GET /people/:person_id/activities/new(.:format) {:action=>"new", :controller=>"people/activities"} - edit_person_activity GET /people/:person_id/activities/:id/edit(.:format) {:action=>"edit", :controller=>"people/activities"} - person_activity GET /people/:person_id/activities/:id(.:format) {:action=>"show", :controller=>"people/activities"} - PUT /people/:person_id/activities/:id(.:format) {:action=>"update", :controller=>"people/activities"} - DELETE /people/:person_id/activities/:id(.:format) {:action=>"destroy", :controller=>"people/activities"} -new_person_friend_request GET /people/:person_id/friend_request/new(.:format) {:action=>"new", :controller=>"people/friend_requests"} - person_friend_request DELETE /people/:person_id/friend_request(.:format) {:action=>"destroy", :controller=>"people/friend_requests"} - POST /people/:person_id/friend_request(.:format) {:action=>"create", :controller=>"people/friend_requests"} - people GET /people(.:format) {:action=>"index", :controller=>"people/people"} - POST /people(.:format) {:action=>"create", :controller=>"people/people"} - new_person GET /people/new(.:format) {:action=>"new", :controller=>"people/people"} - edit_person GET /people/:id/edit(.:format) {:action=>"edit", :controller=>"people/people"} - person GET /people/:id(.:format) {:action=>"show", :controller=>"people/people"} - PUT /people/:id(.:format) {:action=>"update", :controller=>"people/people"} - DELETE /people/:id(.:format) {:action=>"destroy", :controller=>"people/people"} - networks_directory /networks/directory/:path {:action=>"index", :controller=>"groups/directory"} - groups_directory /groups/directory/:path {:action=>"index", :controller=>"groups/directory"} - group_home GET /groups/:group_id/home(.:format) {:action=>"show", :controller=>"groups/homes"} - new_group_page GET /groups/:group_id/page/new(.:format) {:action=>"new", :controller=>"groups/pages"} - group_page POST /groups/:group_id/page(.:format) {:action=>"create", :controller=>"groups/pages"} - group_pages /groups/:group_id/pages/:path {:action=>"index", :controller=>"groups/pages"} - group_members GET /groups/:group_id/members(.:format) {:action=>"index", :controller=>"groups/members"} - group_member DELETE /groups/:group_id/members/:id(.:format) {:action=>"destroy", :controller=>"groups/members"} - group_memberships POST /groups/:group_id/memberships(.:format) {:action=>"create", :controller=>"groups/memberships"} - new_group_membership GET /groups/:group_id/memberships/new(.:format) {:action=>"new", :controller=>"groups/memberships"} - group_membership DELETE /groups/:group_id/memberships/:id(.:format) {:action=>"destroy", :controller=>"groups/memberships"} - group_committees POST /groups/:group_id/committees(.:format) {:action=>"create", :controller=>"groups/committees"} - new_group_committee GET /groups/:group_id/committees/new(.:format) {:action=>"new", :controller=>"groups/committees"} - group_councils POST /groups/:group_id/councils(.:format) {:action=>"create", :controller=>"groups/councils"} - new_group_council GET /groups/:group_id/councils/new(.:format) {:action=>"new", :controller=>"groups/councils"} - group_invites POST /groups/:group_id/invites(.:format) {:action=>"create", :controller=>"groups/invites"} - new_group_invite GET /groups/:group_id/invites/new(.:format) {:action=>"new", :controller=>"groups/invites"} - group_invite DELETE /groups/:group_id/invites/:id(.:format) {:action=>"destroy", :controller=>"groups/invites"} - group_requests GET /groups/:group_id/requests(.:format) {:action=>"index", :controller=>"groups/requests"} - POST /groups/:group_id/requests(.:format) {:action=>"create", :controller=>"groups/requests"} - new_group_request GET /groups/:group_id/requests/new(.:format) {:action=>"new", :controller=>"groups/requests"} - group_request PUT /groups/:group_id/requests/:id(.:format) {:action=>"update", :controller=>"groups/requests"} - DELETE /groups/:group_id/requests/:id(.:format) {:action=>"destroy", :controller=>"groups/requests"} - group_events GET /groups/:group_id/events(.:format) {:action=>"index", :controller=>"groups/events"} - POST /groups/:group_id/events(.:format) {:action=>"create", :controller=>"groups/events"} - new_group_event GET /groups/:group_id/events/new(.:format) {:action=>"new", :controller=>"groups/events"} - edit_group_event GET /groups/:group_id/events/:id/edit(.:format) {:action=>"edit", :controller=>"groups/events"} - group_event GET /groups/:group_id/events/:id(.:format) {:action=>"show", :controller=>"groups/events"} - PUT /groups/:group_id/events/:id(.:format) {:action=>"update", :controller=>"groups/events"} - DELETE /groups/:group_id/events/:id(.:format) {:action=>"destroy", :controller=>"groups/events"} - group_permissions GET /groups/:group_id/permissions(.:format) {:action=>"index", :controller=>"groups/permissions"} - POST /groups/:group_id/permissions(.:format) {:action=>"create", :controller=>"groups/permissions"} - new_group_permission GET /groups/:group_id/permissions/new(.:format) {:action=>"new", :controller=>"groups/permissions"} - edit_group_permission GET /groups/:group_id/permissions/:id/edit(.:format) {:action=>"edit", :controller=>"groups/permissions"} - group_permission GET /groups/:group_id/permissions/:id(.:format) {:action=>"show", :controller=>"groups/permissions"} - PUT /groups/:group_id/permissions/:id(.:format) {:action=>"update", :controller=>"groups/permissions"} - DELETE /groups/:group_id/permissions/:id(.:format) {:action=>"destroy", :controller=>"groups/permissions"} - group_activities GET /groups/:group_id/activities(.:format) {:action=>"index", :controller=>"groups/activities"} - POST /groups/:group_id/activities(.:format) {:action=>"create", :controller=>"groups/activities"} - new_group_activity GET /groups/:group_id/activities/new(.:format) {:action=>"new", :controller=>"groups/activities"} - edit_group_activity GET /groups/:group_id/activities/:id/edit(.:format) {:action=>"edit", :controller=>"groups/activities"} - group_activity GET /groups/:group_id/activities/:id(.:format) {:action=>"show", :controller=>"groups/activities"} - PUT /groups/:group_id/activities/:id(.:format) {:action=>"update", :controller=>"groups/activities"} - DELETE /groups/:group_id/activities/:id(.:format) {:action=>"destroy", :controller=>"groups/activities"} - new_group_profile GET /groups/:group_id/profile/new(.:format) {:action=>"new", :controller=>"groups/profile"} - edit_group_profile GET /groups/:group_id/profile/edit(.:format) {:action=>"edit", :controller=>"groups/profile"} - group_profile GET /groups/:group_id/profile(.:format) {:action=>"show", :controller=>"groups/profile"} - PUT /groups/:group_id/profile(.:format) {:action=>"update", :controller=>"groups/profile"} - DELETE /groups/:group_id/profile(.:format) {:action=>"destroy", :controller=>"groups/profile"} - POST /groups/:group_id/profile(.:format) {:action=>"create", :controller=>"groups/profile"} - group_settings GET /groups/:group_id/settings(.:format) {:action=>"show", :controller=>"groups/settings"} - PUT /groups/:group_id/settings(.:format) {:action=>"update", :controller=>"groups/settings"} - group_avatars GET /groups/:group_id/avatars(.:format) {:action=>"index", :controller=>"groups/avatars"} - POST /groups/:group_id/avatars(.:format) {:action=>"create", :controller=>"groups/avatars"} - new_group_avatar GET /groups/:group_id/avatars/new(.:format) {:action=>"new", :controller=>"groups/avatars"} - edit_group_avatar GET /groups/:group_id/avatars/:id/edit(.:format) {:action=>"edit", :controller=>"groups/avatars"} - group_avatar GET /groups/:group_id/avatars/:id(.:format) {:action=>"show", :controller=>"groups/avatars"} - PUT /groups/:group_id/avatars/:id(.:format) {:action=>"update", :controller=>"groups/avatars"} - DELETE /groups/:group_id/avatars/:id(.:format) {:action=>"destroy", :controller=>"groups/avatars"} - groups POST /groups(.:format) {:action=>"create", :controller=>"groups/groups"} - new_group GET /groups/new(.:format) {:action=>"new", :controller=>"groups/groups"} - group DELETE /groups/:id(.:format) {:action=>"destroy", :controller=>"groups/groups"} - network_home GET /networks/:network_id/home(.:format) {:action=>"show", :controller=>"groups/homes"} - new_network_page GET /networks/:network_id/page/new(.:format) {:action=>"new", :controller=>"groups/pages"} - network_page POST /networks/:network_id/page(.:format) {:action=>"create", :controller=>"groups/pages"} - network_pages /networks/:network_id/pages/:path {:action=>"index", :controller=>"groups/pages"} - network_members GET /networks/:network_id/members(.:format) {:action=>"index", :controller=>"groups/members"} - network_member DELETE /networks/:network_id/members/:id(.:format) {:action=>"destroy", :controller=>"groups/members"} - network_memberships POST /networks/:network_id/memberships(.:format) {:action=>"create", :controller=>"groups/memberships"} - new_network_membership GET /networks/:network_id/memberships/new(.:format) {:action=>"new", :controller=>"groups/memberships"} - network_membership DELETE /networks/:network_id/memberships/:id(.:format) {:action=>"destroy", :controller=>"groups/memberships"} - network_committees POST /networks/:network_id/committees(.:format) {:action=>"create", :controller=>"groups/committees"} - new_network_committee GET /networks/:network_id/committees/new(.:format) {:action=>"new", :controller=>"groups/committees"} - network_councils POST /networks/:network_id/councils(.:format) {:action=>"create", :controller=>"groups/councils"} - new_network_council GET /networks/:network_id/councils/new(.:format) {:action=>"new", :controller=>"groups/councils"} - network_invites POST /networks/:network_id/invites(.:format) {:action=>"create", :controller=>"groups/invites"} - new_network_invite GET /networks/:network_id/invites/new(.:format) {:action=>"new", :controller=>"groups/invites"} - network_invite DELETE /networks/:network_id/invites/:id(.:format) {:action=>"destroy", :controller=>"groups/invites"} - network_requests GET /networks/:network_id/requests(.:format) {:action=>"index", :controller=>"groups/requests"} - POST /networks/:network_id/requests(.:format) {:action=>"create", :controller=>"groups/requests"} - new_network_request GET /networks/:network_id/requests/new(.:format) {:action=>"new", :controller=>"groups/requests"} - network_request PUT /networks/:network_id/requests/:id(.:format) {:action=>"update", :controller=>"groups/requests"} - DELETE /networks/:network_id/requests/:id(.:format) {:action=>"destroy", :controller=>"groups/requests"} - network_events GET /networks/:network_id/events(.:format) {:action=>"index", :controller=>"groups/events"} - POST /networks/:network_id/events(.:format) {:action=>"create", :controller=>"groups/events"} - new_network_event GET /networks/:network_id/events/new(.:format) {:action=>"new", :controller=>"groups/events"} - edit_network_event GET /networks/:network_id/events/:id/edit(.:format) {:action=>"edit", :controller=>"groups/events"} - network_event GET /networks/:network_id/events/:id(.:format) {:action=>"show", :controller=>"groups/events"} - PUT /networks/:network_id/events/:id(.:format) {:action=>"update", :controller=>"groups/events"} - DELETE /networks/:network_id/events/:id(.:format) {:action=>"destroy", :controller=>"groups/events"} - network_permissions GET /networks/:network_id/permissions(.:format) {:action=>"index", :controller=>"groups/permissions"} - POST /networks/:network_id/permissions(.:format) {:action=>"create", :controller=>"groups/permissions"} - new_network_permission GET /networks/:network_id/permissions/new(.:format) {:action=>"new", :controller=>"groups/permissions"} - edit_network_permission GET /networks/:network_id/permissions/:id/edit(.:format) {:action=>"edit", :controller=>"groups/permissions"} - network_permission GET /networks/:network_id/permissions/:id(.:format) {:action=>"show", :controller=>"groups/permissions"} - PUT /networks/:network_id/permissions/:id(.:format) {:action=>"update", :controller=>"groups/permissions"} - DELETE /networks/:network_id/permissions/:id(.:format) {:action=>"destroy", :controller=>"groups/permissions"} - network_activities GET /networks/:network_id/activities(.:format) {:action=>"index", :controller=>"groups/activities"} - POST /networks/:network_id/activities(.:format) {:action=>"create", :controller=>"groups/activities"} - new_network_activity GET /networks/:network_id/activities/new(.:format) {:action=>"new", :controller=>"groups/activities"} - edit_network_activity GET /networks/:network_id/activities/:id/edit(.:format) {:action=>"edit", :controller=>"groups/activities"} - network_activity GET /networks/:network_id/activities/:id(.:format) {:action=>"show", :controller=>"groups/activities"} - PUT /networks/:network_id/activities/:id(.:format) {:action=>"update", :controller=>"groups/activities"} - DELETE /networks/:network_id/activities/:id(.:format) {:action=>"destroy", :controller=>"groups/activities"} - new_network_profile GET /networks/:network_id/profile/new(.:format) {:action=>"new", :controller=>"groups/profile"} - edit_network_profile GET /networks/:network_id/profile/edit(.:format) {:action=>"edit", :controller=>"groups/profile"} - network_profile GET /networks/:network_id/profile(.:format) {:action=>"show", :controller=>"groups/profile"} - PUT /networks/:network_id/profile(.:format) {:action=>"update", :controller=>"groups/profile"} - DELETE /networks/:network_id/profile(.:format) {:action=>"destroy", :controller=>"groups/profile"} - POST /networks/:network_id/profile(.:format) {:action=>"create", :controller=>"groups/profile"} - network_settings GET /networks/:network_id/settings(.:format) {:action=>"show", :controller=>"groups/settings"} - PUT /networks/:network_id/settings(.:format) {:action=>"update", :controller=>"groups/settings"} - network_avatars GET /networks/:network_id/avatars(.:format) {:action=>"index", :controller=>"groups/avatars"} - POST /networks/:network_id/avatars(.:format) {:action=>"create", :controller=>"groups/avatars"} - new_network_avatar GET /networks/:network_id/avatars/new(.:format) {:action=>"new", :controller=>"groups/avatars"} - edit_network_avatar GET /networks/:network_id/avatars/:id/edit(.:format) {:action=>"edit", :controller=>"groups/avatars"} - network_avatar GET /networks/:network_id/avatars/:id(.:format) {:action=>"show", :controller=>"groups/avatars"} - PUT /networks/:network_id/avatars/:id(.:format) {:action=>"update", :controller=>"groups/avatars"} - DELETE /networks/:network_id/avatars/:id(.:format) {:action=>"destroy", :controller=>"groups/avatars"} - networks POST /networks(.:format) {:action=>"create", :controller=>"groups/networks"} - new_network GET /networks/new(.:format) {:action=>"new", :controller=>"groups/networks"} - network DELETE /networks/:id(.:format) {:action=>"destroy", :controller=>"groups/networks"} - debug_become /debug/become {:action=>"become", :controller=>"debug"} - debug_report /debug/report/submit {:action=>"submit", :controller=>"bugreport"} - page_creation /pages/:action/:owner/:type {:controller=>"pages/create"} - page_participations GET /pages/:page_id/participations(.:format) {:action=>"index", :controller=>"pages/participations"} - POST /pages/:page_id/participations(.:format) {:action=>"create", :controller=>"pages/participations"} - page_participation PUT /pages/:page_id/participations/:id(.:format) {:action=>"update", :controller=>"pages/participations"} - page_changes GET /pages/:page_id/changes(.:format) {:action=>"index", :controller=>"pages/changes"} - POST /pages/:page_id/changes(.:format) {:action=>"create", :controller=>"pages/changes"} - new_page_change GET /pages/:page_id/changes/new(.:format) {:action=>"new", :controller=>"pages/changes"} - edit_page_change GET /pages/:page_id/changes/:id/edit(.:format) {:action=>"edit", :controller=>"pages/changes"} - page_change GET /pages/:page_id/changes/:id(.:format) {:action=>"show", :controller=>"pages/changes"} - PUT /pages/:page_id/changes/:id(.:format) {:action=>"update", :controller=>"pages/changes"} - DELETE /pages/:page_id/changes/:id(.:format) {:action=>"destroy", :controller=>"pages/changes"} - page_assets GET /pages/:page_id/assets(.:format) {:action=>"index", :controller=>"pages/assets"} - POST /pages/:page_id/assets(.:format) {:action=>"create", :controller=>"pages/assets"} - new_page_asset GET /pages/:page_id/assets/new(.:format) {:action=>"new", :controller=>"pages/assets"} - edit_page_asset GET /pages/:page_id/assets/:id/edit(.:format) {:action=>"edit", :controller=>"pages/assets"} - page_asset GET /pages/:page_id/assets/:id(.:format) {:action=>"show", :controller=>"pages/assets"} - PUT /pages/:page_id/assets/:id(.:format) {:action=>"update", :controller=>"pages/assets"} - DELETE /pages/:page_id/assets/:id(.:format) {:action=>"destroy", :controller=>"pages/assets"} - page_tags GET /pages/:page_id/tags(.:format) {:action=>"index", :controller=>"pages/tags"} - POST /pages/:page_id/tags(.:format) {:action=>"create", :controller=>"pages/tags"} - new_page_tag GET /pages/:page_id/tags/new(.:format) {:action=>"new", :controller=>"pages/tags"} - edit_page_tag GET /pages/:page_id/tags/:id/edit(.:format) {:action=>"edit", :controller=>"pages/tags"} - page_tag GET /pages/:page_id/tags/:id(.:format) {:action=>"show", :controller=>"pages/tags"} - PUT /pages/:page_id/tags/:id(.:format) {:action=>"update", :controller=>"pages/tags"} - DELETE /pages/:page_id/tags/:id(.:format) {:action=>"destroy", :controller=>"pages/tags"} - page_posts POST /pages/:page_id/posts(.:format) {:action=>"create", :controller=>"pages/posts"} - edit_page_post /pages/:page_id/posts/:id/edit(.:format) {:action=>"edit", :controller=>"pages/posts"} - GET /pages/:page_id/posts/:id/edit(.:format) {:action=>"edit", :controller=>"pages/posts"} - page_post GET /pages/:page_id/posts/:id(.:format) {:action=>"show", :controller=>"pages/posts"} - PUT /pages/:page_id/posts/:id(.:format) {:action=>"update", :controller=>"pages/posts"} - page_sidebar GET /pages/:page_id/sidebar(.:format) {:action=>"show", :controller=>"pages/sidebars"} - page_share GET /pages/:page_id/share(.:format) {:action=>"show", :controller=>"pages/shares"} - PUT /pages/:page_id/share(.:format) {:action=>"update", :controller=>"pages/shares"} - page_details GET /pages/:page_id/details(.:format) {:action=>"show", :controller=>"pages/details"} - page_attributes PUT /pages/:page_id/attributes(.:format) {:action=>"update", :controller=>"pages/attributes"} - edit_page_title GET /pages/:page_id/title/edit(.:format) {:action=>"edit", :controller=>"pages/title"} - page_title PUT /pages/:page_id/title(.:format) {:action=>"update", :controller=>"pages/title"} - edit_page_trash GET /pages/:page_id/trash/edit(.:format) {:action=>"edit", :controller=>"pages/trash"} - page_trash PUT /pages/:page_id/trash(.:format) {:action=>"update", :controller=>"pages/trash"} - pages GET /pages(.:format) {:action=>"index", :controller=>"pages/base"} - POST /pages(.:format) {:action=>"create", :controller=>"pages/base"} - new_page GET /pages/new(.:format) {:action=>"new", :controller=>"pages/base"} - edit_page GET /pages/:id/edit(.:format) {:action=>"edit", :controller=>"pages/base"} - page GET /pages/:id(.:format) {:action=>"show", :controller=>"pages/base"} - PUT /pages/:id(.:format) {:action=>"update", :controller=>"pages/base"} - DELETE /pages/:id(.:format) {:action=>"destroy", :controller=>"pages/base"} - /pages/:controller/:action/:page_id {:constraints=>{:controller=>/.*_page/}} - /do/:controller/:action/:id - root / {:action=>"index", :controller=>"root"} - /:_context/:_page/:path {:action=>"dispatch", :controller=>"dispatch"} - /:_context {:action=>"dispatch", :controller=>"dispatch"} + create_asset /assets/create/:id {:controller=>"assets", :action=>"create"} + destroy_asset /assets/destroy/:id {:controller=>"assets", :action=>"destroy"} + asset_version /assets/:id/versions/:version/:path {:controller=>"assets", :action=>"show"} + asset /assets/:id/:path {:controller=>"assets", :action=>"show"} + avatar /avatars/:id/:size.jpg {:controller=>"avatars", :action=>"show"} + /theme/:name/:file.css {:controller=>"theme", :action=>"show"} + pictures /pictures/:id1/:id2/:geometry(.:format) {:controller=>"pictures", :action=>"show"} + me_notices GET /me/notices(.:format) {:controller=>"me/notices", :action=>"index"} + POST /me/notices(.:format) {:controller=>"me/notices", :action=>"create"} + new_me_notice GET /me/notices/new(.:format) {:controller=>"me/notices", :action=>"new"} + edit_me_notice GET /me/notices/:id/edit(.:format) {:controller=>"me/notices", :action=>"edit"} + me_notice GET /me/notices/:id(.:format) {:controller=>"me/notices", :action=>"show"} + PUT /me/notices/:id(.:format) {:controller=>"me/notices", :action=>"update"} + DELETE /me/notices/:id(.:format) {:controller=>"me/notices", :action=>"destroy"} + me_home /me {:controller=>"me/notices", :action=>"index"} + new_me_page GET /me/page/new(.:format) {:controller=>"me/pages", :action=>"new"} + me_page POST /me/page(.:format) {:controller=>"me/pages", :action=>"create"} + me_recent_pages GET /me/recent_pages(.:format) {:controller=>"me/recent_pages", :action=>"index"} + me_pages /me/pages/:path {:controller=>"me/pages", :action=>"index"} + me_activities GET /me/activities(.:format) {:controller=>"me/activities", :action=>"index"} + POST /me/activities(.:format) {:controller=>"me/activities", :action=>"create"} + new_me_activity GET /me/activities/new(.:format) {:controller=>"me/activities", :action=>"new"} + edit_me_activity GET /me/activities/:id/edit(.:format) {:controller=>"me/activities", :action=>"edit"} + me_activity GET /me/activities/:id(.:format) {:controller=>"me/activities", :action=>"show"} + PUT /me/activities/:id(.:format) {:controller=>"me/activities", :action=>"update"} + DELETE /me/activities/:id(.:format) {:controller=>"me/activities", :action=>"destroy"} + me_discussion_posts GET /me/messages/:discussion_id/posts(.:format) {:controller=>"me/posts", :action=>"index"} + POST /me/messages/:discussion_id/posts(.:format) {:controller=>"me/posts", :action=>"create"} + new_me_discussion_post GET /me/messages/:discussion_id/posts/new(.:format) {:controller=>"me/posts", :action=>"new"} + edit_me_discussion_post GET /me/messages/:discussion_id/posts/:id/edit(.:format) {:controller=>"me/posts", :action=>"edit"} + me_discussion_post GET /me/messages/:discussion_id/posts/:id(.:format) {:controller=>"me/posts", :action=>"show"} + PUT /me/messages/:discussion_id/posts/:id(.:format) {:controller=>"me/posts", :action=>"update"} + DELETE /me/messages/:discussion_id/posts/:id(.:format) {:controller=>"me/posts", :action=>"destroy"} + me_discussions GET /me/messages(.:format) {:controller=>"me/discussions", :action=>"index"} + POST /me/messages(.:format) {:controller=>"me/discussions", :action=>"create"} + new_me_discussion GET /me/messages/new(.:format) {:controller=>"me/discussions", :action=>"new"} + edit_me_discussion GET /me/messages/:id/edit(.:format) {:controller=>"me/discussions", :action=>"edit"} + me_discussion GET /me/messages/:id(.:format) {:controller=>"me/discussions", :action=>"show"} + PUT /me/messages/:id(.:format) {:controller=>"me/discussions", :action=>"update"} + DELETE /me/messages/:id(.:format) {:controller=>"me/discussions", :action=>"destroy"} + me_settings GET /me/settings(.:format) {:controller=>"me/settings", :action=>"show"} + PUT /me/settings(.:format) {:controller=>"me/settings", :action=>"update"} + me_destroy GET /me/destroy(.:format) {:controller=>"me/destroys", :action=>"show"} + PUT /me/destroy(.:format) {:controller=>"me/destroys", :action=>"update"} + edit_me_password GET /me/password/edit(.:format) {:controller=>"me/passwords", :action=>"edit"} + me_password PUT /me/password(.:format) {:controller=>"me/passwords", :action=>"update"} + me_permissions GET /me/permissions(.:format) {:controller=>"me/permissions", :action=>"index"} + POST /me/permissions(.:format) {:controller=>"me/permissions", :action=>"create"} + new_me_permission GET /me/permissions/new(.:format) {:controller=>"me/permissions", :action=>"new"} + edit_me_permission GET /me/permissions/:id/edit(.:format) {:controller=>"me/permissions", :action=>"edit"} + me_permission GET /me/permissions/:id(.:format) {:controller=>"me/permissions", :action=>"show"} + PUT /me/permissions/:id(.:format) {:controller=>"me/permissions", :action=>"update"} + DELETE /me/permissions/:id(.:format) {:controller=>"me/permissions", :action=>"destroy"} + edit_me_profile GET /me/profile/edit(.:format) {:controller=>"me/profile", :action=>"edit"} + me_profile PUT /me/profile(.:format) {:controller=>"me/profile", :action=>"update"} + me_requests GET /me/requests(.:format) {:controller=>"me/requests", :action=>"index"} + me_request GET /me/requests/:id(.:format) {:controller=>"me/requests", :action=>"show"} + PUT /me/requests/:id(.:format) {:controller=>"me/requests", :action=>"update"} + DELETE /me/requests/:id(.:format) {:controller=>"me/requests", :action=>"destroy"} + me_events GET /me/events(.:format) {:controller=>"me/events", :action=>"index"} + POST /me/events(.:format) {:controller=>"me/events", :action=>"create"} + new_me_event GET /me/events/new(.:format) {:controller=>"me/events", :action=>"new"} + edit_me_event GET /me/events/:id/edit(.:format) {:controller=>"me/events", :action=>"edit"} + me_event GET /me/events/:id(.:format) {:controller=>"me/events", :action=>"show"} + PUT /me/events/:id(.:format) {:controller=>"me/events", :action=>"update"} + DELETE /me/events/:id(.:format) {:controller=>"me/events", :action=>"destroy"} + me_avatars GET /me/avatars(.:format) {:controller=>"me/avatars", :action=>"index"} + POST /me/avatars(.:format) {:controller=>"me/avatars", :action=>"create"} + new_me_avatar GET /me/avatars/new(.:format) {:controller=>"me/avatars", :action=>"new"} + edit_me_avatar GET /me/avatars/:id/edit(.:format) {:controller=>"me/avatars", :action=>"edit"} + me_avatar GET /me/avatars/:id(.:format) {:controller=>"me/avatars", :action=>"show"} + PUT /me/avatars/:id(.:format) {:controller=>"me/avatars", :action=>"update"} + DELETE /me/avatars/:id(.:format) {:controller=>"me/avatars", :action=>"destroy"} + reset_password /account/reset_password/:token {:controller=>"account", :action=>"reset_password"} + verify_account /account/verify_email/:token {:controller=>"account", :action=>"verify_email"} + new_account /account/new {:controller=>"account", :action=>"new"} + account /account/:action/:id {:controller=>"account"} + language /session/language {:controller=>"session", :action=>"language"} + login /session/login {:controller=>"session", :action=>"login"} + logout /session/logout {:controller=>"session", :action=>"logout"} + session /session/:action/:id {:controller=>"session"} + entities GET /entities(.:format) {:controller=>"entities", :action=>"index"} + people_directory /people/directory/:path {:controller=>"people/directory", :action=>"index"} + person_home GET /people/:person_id/home(.:format) {:controller=>"people/homes", :action=>"show"} + person_pages /people/:person_id/pages/:path {:controller=>"people/pages", :action=>"index"} + person_messages GET /people/:person_id/messages(.:format) {:controller=>"people/messages", :action=>"index"} + POST /people/:person_id/messages(.:format) {:controller=>"people/messages", :action=>"create"} + new_person_message GET /people/:person_id/messages/new(.:format) {:controller=>"people/messages", :action=>"new"} + edit_person_message GET /people/:person_id/messages/:id/edit(.:format) {:controller=>"people/messages", :action=>"edit"} + person_message GET /people/:person_id/messages/:id(.:format) {:controller=>"people/messages", :action=>"show"} + PUT /people/:person_id/messages/:id(.:format) {:controller=>"people/messages", :action=>"update"} + DELETE /people/:person_id/messages/:id(.:format) {:controller=>"people/messages", :action=>"destroy"} + person_activities GET /people/:person_id/activities(.:format) {:controller=>"people/activities", :action=>"index"} + POST /people/:person_id/activities(.:format) {:controller=>"people/activities", :action=>"create"} + new_person_activity GET /people/:person_id/activities/new(.:format) {:controller=>"people/activities", :action=>"new"} + edit_person_activity GET /people/:person_id/activities/:id/edit(.:format) {:controller=>"people/activities", :action=>"edit"} + person_activity GET /people/:person_id/activities/:id(.:format) {:controller=>"people/activities", :action=>"show"} + PUT /people/:person_id/activities/:id(.:format) {:controller=>"people/activities", :action=>"update"} + DELETE /people/:person_id/activities/:id(.:format) {:controller=>"people/activities", :action=>"destroy"} + new_person_friend_request GET /people/:person_id/friend_request/new(.:format) {:controller=>"people/friend_requests", :action=>"new"} + person_friend_request DELETE /people/:person_id/friend_request(.:format) {:controller=>"people/friend_requests", :action=>"destroy"} + POST /people/:person_id/friend_request(.:format) {:controller=>"people/friend_requests", :action=>"create"} + people GET /people(.:format) {:controller=>"people/people", :action=>"index"} + POST /people(.:format) {:controller=>"people/people", :action=>"create"} + new_person GET /people/new(.:format) {:controller=>"people/people", :action=>"new"} + edit_person GET /people/:id/edit(.:format) {:controller=>"people/people", :action=>"edit"} + person GET /people/:id(.:format) {:controller=>"people/people", :action=>"show"} + PUT /people/:id(.:format) {:controller=>"people/people", :action=>"update"} + DELETE /people/:id(.:format) {:controller=>"people/people", :action=>"destroy"} + networks_directory /networks/directory/:path {:controller=>"groups/directory", :action=>"index"} + groups_directory /groups/directory/:path {:controller=>"groups/directory", :action=>"index"} + group_home GET /groups/:group_id/home(.:format) {:controller=>"groups/home", :action=>"show"} + group_pages /groups/:group_id/pages/:path {:controller=>"groups/pages", :action=>"index"} + group_avatars GET /groups/:group_id/avatars(.:format) {:controller=>"groups/avatars", :action=>"index"} + POST /groups/:group_id/avatars(.:format) {:controller=>"groups/avatars", :action=>"create"} + new_group_avatar GET /groups/:group_id/avatars/new(.:format) {:controller=>"groups/avatars", :action=>"new"} + edit_group_avatar GET /groups/:group_id/avatars/:id/edit(.:format) {:controller=>"groups/avatars", :action=>"edit"} + group_avatar GET /groups/:group_id/avatars/:id(.:format) {:controller=>"groups/avatars", :action=>"show"} + PUT /groups/:group_id/avatars/:id(.:format) {:controller=>"groups/avatars", :action=>"update"} + DELETE /groups/:group_id/avatars/:id(.:format) {:controller=>"groups/avatars", :action=>"destroy"} + group_wikis POST /groups/:group_id/wikis(.:format) {:controller=>"groups/wikis", :action=>"create"} + new_group_wiki GET /groups/:group_id/wikis/new(.:format) {:controller=>"groups/wikis", :action=>"new"} + edit_group_wiki GET /groups/:group_id/wikis/:id/edit(.:format) {:controller=>"groups/wikis", :action=>"edit"} + group_wiki GET /groups/:group_id/wikis/:id(.:format) {:controller=>"groups/wikis", :action=>"show"} + PUT /groups/:group_id/wikis/:id(.:format) {:controller=>"groups/wikis", :action=>"update"} + group_memberships GET /groups/:group_id/memberships(.:format) {:controller=>"groups/memberships", :action=>"index"} + POST /groups/:group_id/memberships(.:format) {:controller=>"groups/memberships", :action=>"create"} + group_membership DELETE /groups/:group_id/memberships/:id(.:format) {:controller=>"groups/memberships", :action=>"destroy"} + group_my_memberships POST /groups/:group_id/my_memberships(.:format) {:controller=>"groups/my_memberships", :action=>"create"} + group_my_membership DELETE /groups/:group_id/my_memberships/:id(.:format) {:controller=>"groups/my_memberships", :action=>"destroy"} + group_membership_requests GET /groups/:group_id/membership_requests(.:format) {:controller=>"groups/membership_requests", :action=>"index"} + POST /groups/:group_id/membership_requests(.:format) {:controller=>"groups/membership_requests", :action=>"create"} + new_group_membership_request GET /groups/:group_id/membership_requests/new(.:format) {:controller=>"groups/membership_requests", :action=>"new"} +edit_group_membership_request GET /groups/:group_id/membership_requests/:id/edit(.:format) {:controller=>"groups/membership_requests", :action=>"edit"} + group_membership_request GET /groups/:group_id/membership_requests/:id(.:format) {:controller=>"groups/membership_requests", :action=>"show"} + PUT /groups/:group_id/membership_requests/:id(.:format) {:controller=>"groups/membership_requests", :action=>"update"} + DELETE /groups/:group_id/membership_requests/:id(.:format) {:controller=>"groups/membership_requests", :action=>"destroy"} + group_invites POST /groups/:group_id/invites(.:format) {:controller=>"groups/invites", :action=>"create"} + new_group_invite GET /groups/:group_id/invites/new(.:format) {:controller=>"groups/invites", :action=>"new"} + group_settings GET /groups/:group_id/settings(.:format) {:controller=>"groups/settings", :action=>"show"} + PUT /groups/:group_id/settings(.:format) {:controller=>"groups/settings", :action=>"update"} + group_requests GET /groups/:group_id/requests(.:format) {:controller=>"groups/requests", :action=>"index"} + POST /groups/:group_id/requests(.:format) {:controller=>"groups/requests", :action=>"create"} + new_group_request GET /groups/:group_id/requests/new(.:format) {:controller=>"groups/requests", :action=>"new"} + edit_group_request GET /groups/:group_id/requests/:id/edit(.:format) {:controller=>"groups/requests", :action=>"edit"} + group_request GET /groups/:group_id/requests/:id(.:format) {:controller=>"groups/requests", :action=>"show"} + PUT /groups/:group_id/requests/:id(.:format) {:controller=>"groups/requests", :action=>"update"} + DELETE /groups/:group_id/requests/:id(.:format) {:controller=>"groups/requests", :action=>"destroy"} + group_permissions GET /groups/:group_id/permissions(.:format) {:controller=>"groups/permissions", :action=>"index"} + group_permission PUT /groups/:group_id/permissions/:id(.:format) {:controller=>"groups/permissions", :action=>"update"} + edit_group_profile GET /groups/:group_id/profile/edit(.:format) {:controller=>"groups/profiles", :action=>"edit"} + group_profile PUT /groups/:group_id/profile(.:format) {:controller=>"groups/profiles", :action=>"update"} + new_group_structure GET /groups/:group_id/structure/new(.:format) {:controller=>"groups/structures", :action=>"new"} + edit_group_structure GET /groups/:group_id/structure/edit(.:format) {:controller=>"groups/structures", :action=>"edit"} + group_structure GET /groups/:group_id/structure(.:format) {:controller=>"groups/structures", :action=>"show"} + PUT /groups/:group_id/structure(.:format) {:controller=>"groups/structures", :action=>"update"} + DELETE /groups/:group_id/structure(.:format) {:controller=>"groups/structures", :action=>"destroy"} + POST /groups/:group_id/structure(.:format) {:controller=>"groups/structures", :action=>"create"} + groups POST /groups(.:format) {:controller=>"groups/groups", :action=>"create"} + new_group GET /groups/new(.:format) {:controller=>"groups/groups", :action=>"new"} + group DELETE /groups/:id(.:format) {:controller=>"groups/groups", :action=>"destroy"} + debug_become /debug/become {:controller=>"debug", :action=>"become"} + debug_break /debug/break {:controller=>"debug", :action=>"break"} + debug_report /debug/report/submit {:controller=>"bugreport", :action=>"submit"} + page_creation /pages/:action/:owner/:type {:controller=>"pages/create"} + page_participations GET /pages/:page_id/participations(.:format) {:controller=>"pages/participations", :action=>"index"} + POST /pages/:page_id/participations(.:format) {:controller=>"pages/participations", :action=>"create"} + page_participation PUT /pages/:page_id/participations/:id(.:format) {:controller=>"pages/participations", :action=>"update"} + page_changes GET /pages/:page_id/changes(.:format) {:controller=>"pages/changes", :action=>"index"} + POST /pages/:page_id/changes(.:format) {:controller=>"pages/changes", :action=>"create"} + new_page_change GET /pages/:page_id/changes/new(.:format) {:controller=>"pages/changes", :action=>"new"} + edit_page_change GET /pages/:page_id/changes/:id/edit(.:format) {:controller=>"pages/changes", :action=>"edit"} + page_change GET /pages/:page_id/changes/:id(.:format) {:controller=>"pages/changes", :action=>"show"} + PUT /pages/:page_id/changes/:id(.:format) {:controller=>"pages/changes", :action=>"update"} + DELETE /pages/:page_id/changes/:id(.:format) {:controller=>"pages/changes", :action=>"destroy"} + page_assets GET /pages/:page_id/assets(.:format) {:controller=>"pages/assets", :action=>"index"} + POST /pages/:page_id/assets(.:format) {:controller=>"pages/assets", :action=>"create"} + new_page_asset GET /pages/:page_id/assets/new(.:format) {:controller=>"pages/assets", :action=>"new"} + edit_page_asset GET /pages/:page_id/assets/:id/edit(.:format) {:controller=>"pages/assets", :action=>"edit"} + page_asset GET /pages/:page_id/assets/:id(.:format) {:controller=>"pages/assets", :action=>"show"} + PUT /pages/:page_id/assets/:id(.:format) {:controller=>"pages/assets", :action=>"update"} + DELETE /pages/:page_id/assets/:id(.:format) {:controller=>"pages/assets", :action=>"destroy"} + page_tags GET /pages/:page_id/tags(.:format) {:controller=>"pages/tags", :action=>"index"} + POST /pages/:page_id/tags(.:format) {:controller=>"pages/tags", :action=>"create"} + new_page_tag GET /pages/:page_id/tags/new(.:format) {:controller=>"pages/tags", :action=>"new"} + edit_page_tag GET /pages/:page_id/tags/:id/edit(.:format) {:controller=>"pages/tags", :action=>"edit"} + page_tag GET /pages/:page_id/tags/:id(.:format) {:controller=>"pages/tags", :action=>"show"} + PUT /pages/:page_id/tags/:id(.:format) {:controller=>"pages/tags", :action=>"update"} + DELETE /pages/:page_id/tags/:id(.:format) {:controller=>"pages/tags", :action=>"destroy"} + page_posts POST /pages/:page_id/posts(.:format) {:controller=>"pages/posts", :action=>"create"} + edit_page_post /pages/:page_id/posts/:id/edit(.:format) {:controller=>"pages/posts", :action=>"edit"} + GET /pages/:page_id/posts/:id/edit(.:format) {:controller=>"pages/posts", :action=>"edit"} + page_post GET /pages/:page_id/posts/:id(.:format) {:controller=>"pages/posts", :action=>"show"} + PUT /pages/:page_id/posts/:id(.:format) {:controller=>"pages/posts", :action=>"update"} + page_sidebar GET /pages/:page_id/sidebar(.:format) {:controller=>"pages/sidebars", :action=>"show"} + page_share GET /pages/:page_id/share(.:format) {:controller=>"pages/shares", :action=>"show"} + PUT /pages/:page_id/share(.:format) {:controller=>"pages/shares", :action=>"update"} + page_details GET /pages/:page_id/details(.:format) {:controller=>"pages/details", :action=>"show"} + page_history GET /pages/:page_id/history(.:format) {:controller=>"pages/history", :action=>"show"} + page_attributes PUT /pages/:page_id/attributes(.:format) {:controller=>"pages/attributes", :action=>"update"} + edit_page_title GET /pages/:page_id/title/edit(.:format) {:controller=>"pages/title", :action=>"edit"} + page_title PUT /pages/:page_id/title(.:format) {:controller=>"pages/title", :action=>"update"} + edit_page_trash GET /pages/:page_id/trash/edit(.:format) {:controller=>"pages/trash", :action=>"edit"} + page_trash PUT /pages/:page_id/trash(.:format) {:controller=>"pages/trash", :action=>"update"} + pages GET /pages(.:format) {:controller=>"pages/base", :action=>"index"} + POST /pages(.:format) {:controller=>"pages/base", :action=>"create"} + new_page GET /pages/new(.:format) {:controller=>"pages/base", :action=>"new"} + edit_page GET /pages/:id/edit(.:format) {:controller=>"pages/base", :action=>"edit"} + page GET /pages/:id(.:format) {:controller=>"pages/base", :action=>"show"} + PUT /pages/:id(.:format) {:controller=>"pages/base", :action=>"update"} + DELETE /pages/:id(.:format) {:controller=>"pages/base", :action=>"destroy"} + /pages/:controller/:action/:page_id {:constraints=>{:controller=>/.*_page/}} + wiki_lock DELETE /wikis/:wiki_id/lock(.:format) {:controller=>"wikis/locks", :action=>"destroy"} + wiki_assets POST /wikis/:wiki_id/assets(.:format) {:controller=>"wikis/assets", :action=>"create"} + new_wiki_asset GET /wikis/:wiki_id/assets/new(.:format) {:controller=>"wikis/assets", :action=>"new"} + wiki_versions GET /wikis/:wiki_id/versions(.:format) {:controller=>"wikis/versions", :action=>"index"} + revert_wiki_version POST /wikis/:wiki_id/versions/:id/revert(.:format) {:controller=>"wikis/versions", :action=>"revert"} + wiki_version GET /wikis/:wiki_id/versions/:id(.:format) {:controller=>"wikis/versions", :action=>"show"} + DELETE /wikis/:wiki_id/versions/:id(.:format) {:controller=>"wikis/versions", :action=>"destroy"} + wiki_diff GET /wikis/:wiki_id/diffs/:id(.:format) {:controller=>"wikis/diffs", :action=>"show"} + edit_wiki_section GET /wikis/:wiki_id/sections/:id/edit(.:format) {:controller=>"wikis/sections", :action=>"edit"} + wiki_section PUT /wikis/:wiki_id/sections/:id(.:format) {:controller=>"wikis/sections", :action=>"update"} + edit_wiki GET /wikis/:id/edit(.:format) {:controller=>"wikis/wikis", :action=>"edit"} + print_wiki GET /wikis/:id/print(.:format) {:controller=>"wikis/wikis", :action=>"print"} + wiki GET /wikis/:id(.:format) {:controller=>"wikis/wikis", :action=>"show"} + PUT /wikis/:id(.:format) {:controller=>"wikis/wikis", :action=>"update"} + /do/:controller/:action/:id + root / {:controller=>"root", :action=>"index"} + /:_context/:_page/:path {:controller=>"dispatch", :action=>"dispatch"} + /:_context {:controller=>"dispatch", :action=>"dispatch"} diff --git a/extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb b/extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb index 0bdaf48212248fb583ac17cbc685a91a69eba582..c88deac7e12cad9666d708d0faf9c57952ade5d3 100644 --- a/extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb +++ b/extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb @@ -63,16 +63,6 @@ class GalleryImageController < Pages::BaseController end end - def destroy - asset = Asset.find(params[:id]) - @page.remove_image!(asset) # this also destroys the asset - if request.xhr? - render :layout => false - else - redirect_to page_url(@page) - end - end - protected # just carrying over stuff from the old gallery controller here diff --git a/extensions/pages/gallery_page/app/models/assets_have_galleries.rb b/extensions/pages/gallery_page/app/models/assets_have_galleries.rb deleted file mode 100644 index 7824b66444bb33cecc10c371bcad2e9bfa61c99d..0000000000000000000000000000000000000000 --- a/extensions/pages/gallery_page/app/models/assets_have_galleries.rb +++ /dev/null @@ -1,16 +0,0 @@ -module AssetsHaveGalleries - def self.add_to_class_definition - lambda do - has_one :showing - has_one :gallery, :through => :showing - end - end - module InstanceMethods - def change_source_file(data) - raise Exception.new(I18n.t(:file_must_be_image_error)) unless - Asset.mime_type_from_data(data) =~ /image|pdf/ - self.uploaded_data = data - self.save! - end - end -end diff --git a/extensions/pages/gallery_page/app/models/gallery.rb b/extensions/pages/gallery_page/app/models/gallery.rb index bdaebd683cd60485bb0c9f93306940a7d5f0ff74..63ce844df48a9c10771bf7fd76d445861eae9076 100644 --- a/extensions/pages/gallery_page/app/models/gallery.rb +++ b/extensions/pages/gallery_page/app/models/gallery.rb @@ -38,14 +38,6 @@ class Gallery < Page end alias_method :add_image!, :add_attachment! - # Removes an image from this Gallery by destroying the associating Showing. - # Also destroys the asset itself. - def remove_image!(asset) - showing = self.showings.detect{|showing| showing.asset_id == asset.id} - showing.destroy - asset.destroy - end - def sort_images(sorted_ids) sorted_ids.each_with_index do |id, index| showing = self.showings.find_by_asset_id(id) diff --git a/extensions/pages/gallery_page/app/views/gallery_image/destroy.html.haml b/extensions/pages/gallery_page/app/views/gallery_image/destroy.html.haml deleted file mode 100644 index 0c33fc887bc87e80fa5a9382b4a526feed627bd0..0000000000000000000000000000000000000000 --- a/extensions/pages/gallery_page/app/views/gallery_image/destroy.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -- clear_flash_messages -= message_text :success => I18n.t(:successfully_removed_image) \ No newline at end of file diff --git a/extensions/pages/gallery_page/init.rb b/extensions/pages/gallery_page/init.rb index 776f0004eb78886bda35ca9d9c61799ddd5d9731..47057295b4254e513218f775c709e92b01f594ff 100644 --- a/extensions/pages/gallery_page/init.rb +++ b/extensions/pages/gallery_page/init.rb @@ -11,9 +11,16 @@ define_page_type :Gallery, { extend_model :Asset do - has_many :showings + has_many :showings, :dependent => :destroy has_many :galleries, :through => :showings + def change_source_file(data) + raise Exception.new(I18n.t(:file_must_be_image_error)) unless + Asset.mime_type_from_data(data) =~ /image|pdf/ + self.uploaded_data = data + self.save! + end + # update galleries after an image was saved which has galleries. # the updated_at column of galleries needs to be up to date to allow the # download_gallery action to find out if it's cached zips are up to date. diff --git a/extensions/pages/rate_many_page/app/views/rate_many_page/_new_possible.rhtml b/extensions/pages/rate_many_page/app/views/rate_many_page/_new_possible.rhtml index 10fe165a8231d69ca5bbc33e8323b8b325e2ab84..88341f5adc6d905e533ad623ad1d2a82064111d0 100644 --- a/extensions/pages/rate_many_page/app/views/rate_many_page/_new_possible.rhtml +++ b/extensions/pages/rate_many_page/app/views/rate_many_page/_new_possible.rhtml @@ -16,9 +16,9 @@ :success => "$('new_possible_form').reset()" ) do -%> description:<br/> - <%= text_field 'possible', 'name', :size => 60 %><br/> + <%= text_field 'possible', 'name', :size => 60, :style => "max-width:100%;"%><br/> detail:<br/> - <%= text_area 'possible', 'description', :size => '55x4' %><br/> + <%= text_area 'possible', 'description', :size => '55x4', :style => "max-width:100%" %><br/> <p> <%= submit_tag I18n.t(:add_possibility_button) %> <%= button_to_function "Done", "Element.hide('new_possible_form_container'); Element.show('new_possible_link');" %> diff --git a/test/functional/groups/home_controller_test.rb b/test/functional/groups/home_controller_test.rb index f73179b251c4bae8928eec04d427e3ffd8da2767..fe74cd4e8a8abcffbe8ba6ba6c56f72593366183 100644 --- a/test/functional/groups/home_controller_test.rb +++ b/test/functional/groups/home_controller_test.rb @@ -26,7 +26,7 @@ class Groups::HomeControllerTest < ActionController::TestCase login_as @user @request.env['HTTP_REFERER'] = edit_group_wiki_url(@group, @pub) assert_permission :may_show_group? do - get :show, :id => @group.to_param + get :show, :id => @group.to_param, :wiki_id => @pub.id end assert_response :success assert_equal @pub, assigns('public_wiki') diff --git a/test/functional/groups/wikis_controller_test.rb b/test/functional/groups/wikis_controller_test.rb index 89c6d57d72a7adc25b0c87802a07df9d9b0359f2..94e53b575ee8de2d49f1b470e5782bcc1c9f3fe4 100644 --- a/test/functional/groups/wikis_controller_test.rb +++ b/test/functional/groups/wikis_controller_test.rb @@ -31,7 +31,7 @@ class Groups::WikisControllerTest < ActionController::TestCase xhr :get, :new, :group_id => @group.to_param assert_response :success assert !assigns['wiki'].new_record? - assert_equal @wiki, assigns['wiki'] + assert_template 'groups/home/reload.rjs' end def test_new_with_existing_private_wiki @@ -40,7 +40,7 @@ class Groups::WikisControllerTest < ActionController::TestCase xhr :get, :new, :group_id => @group.to_param, :private => true assert_response :success assert !assigns['wiki'].new_record? - assert_equal @wiki, assigns['wiki'] + assert_template 'groups/home/reload.rjs' end def test_new_private_with_existing_public_wiki @@ -64,7 +64,7 @@ class Groups::WikisControllerTest < ActionController::TestCase assert wiki.profile.private? assert_equal @user, wiki.versions.last.user assert_response :redirect - assert_redirected_to group_url(@group) + assert_redirected_to group_home_url(@group, :wiki_id => wiki.id) end def test_create_public @@ -78,7 +78,7 @@ class Groups::WikisControllerTest < ActionController::TestCase assert "<em>created</em>", wiki.body_html assert wiki.profile.public? assert_response :redirect - assert_redirected_to group_url(@group) + assert_redirected_to group_home_url(@group, :wiki_id => wiki.id) end def test_create_with_existing_wiki @@ -93,7 +93,7 @@ class Groups::WikisControllerTest < ActionController::TestCase assert "<em>created</em>", wiki.body_html assert wiki.profile.public? assert_response :redirect - assert_redirected_to group_url(@group) + assert_redirected_to group_home_url(@group, :wiki_id => wiki.id) end end diff --git a/test/functional/wikis/wikis_controller_test.rb b/test/functional/wikis/wikis_controller_test.rb index 0694a1355a21f4a7f50a33a6a61e3ac667877dc3..211bf5ac0f7be711263a103866abc72d3f5afa47 100644 --- a/test/functional/wikis/wikis_controller_test.rb +++ b/test/functional/wikis/wikis_controller_test.rb @@ -44,7 +44,7 @@ class Wikis::WikisControllerTest < ActionController::TestCase :wiki => {:body => '*updated*', :version => 1} end assert_response :redirect - assert_redirected_to group_url(@group) + assert_redirected_to group_home_url(@group, :wiki_id => @wiki.id) assert_equal "<p><strong>updated</strong></p>", @wiki.reload.body_html end diff --git a/vendor/crabgrass_plugins/after_reload/README b/vendor/crabgrass_plugins/after_reload/README new file mode 100644 index 0000000000000000000000000000000000000000..082f25c6582da8c3b8e3f5fbb177b70f38b0e48e --- /dev/null +++ b/vendor/crabgrass_plugins/after_reload/README @@ -0,0 +1,3 @@ +This plugin will allow you to register methods that get called whenever rails reloads a model in development mode. + +Useful for writing code that modifies models. This way, your modifying code can get called again when it needs to be. diff --git a/vendor/crabgrass_plugins/after_reload/init.rb b/vendor/crabgrass_plugins/after_reload/init.rb new file mode 100644 index 0000000000000000000000000000000000000000..f378be7988389ea6d96241de3a18d13327f08541 --- /dev/null +++ b/vendor/crabgrass_plugins/after_reload/init.rb @@ -0,0 +1,6 @@ +require File.dirname(__FILE__) + '/lib/load_const_callback' +require File.dirname(__FILE__) + '/lib/callback_class_const_missing' +require File.dirname(__FILE__) + '/lib/after_reload' + +Class.instance_eval { include CallbackClassConstMissing } +Object.instance_eval { include AfterReload } diff --git a/vendor/crabgrass_plugins/after_reload/lib/after_reload.rb b/vendor/crabgrass_plugins/after_reload/lib/after_reload.rb new file mode 100644 index 0000000000000000000000000000000000000000..60b6cc08b48941ed43bfeddff19e4daf01a77baa --- /dev/null +++ b/vendor/crabgrass_plugins/after_reload/lib/after_reload.rb @@ -0,0 +1,9 @@ +# +# globally define an after_reload method +# +module AfterReload + private + def after_reload(const, &block) + LoadConstCallback.add(const, &block) + end +end diff --git a/vendor/crabgrass_plugins/after_reload/lib/callback_class_const_missing.rb b/vendor/crabgrass_plugins/after_reload/lib/callback_class_const_missing.rb new file mode 100644 index 0000000000000000000000000000000000000000..37f4757594e0cce92730149a1216fc0c2b321cb2 --- /dev/null +++ b/vendor/crabgrass_plugins/after_reload/lib/callback_class_const_missing.rb @@ -0,0 +1,13 @@ +# +# Override default const_missing. +# see ActiveSupport::Dependencies +# +module CallbackClassConstMissing + def const_missing(const_name) + const = super + if const + LoadConstCallback.fire(const) + end + return const + end +end diff --git a/vendor/crabgrass_plugins/after_reload/lib/load_const_callback.rb b/vendor/crabgrass_plugins/after_reload/lib/load_const_callback.rb new file mode 100644 index 0000000000000000000000000000000000000000..ecf7013f639531b7e236fca388eb1338f5a759b0 --- /dev/null +++ b/vendor/crabgrass_plugins/after_reload/lib/load_const_callback.rb @@ -0,0 +1,24 @@ +# +# module to track the callbacks +# + +module LoadConstCallback + mattr_accessor :callbacks + self.callbacks = {} + + def self.add(model, &block) + model_name = model.to_s + self.callbacks[model_name] ||= [] + self.callbacks[model_name] << block + yield model + end + + def self.fire(model) + model_name = model.to_s + if self.callbacks[model_name] + self.callbacks[model_name].each do |block| + block.call(model) + end + end + end +end diff --git a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates.rb b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates.rb index a4e42d7f028f7eb83dedfbeac02370f0a1a8d12d..ff0f11c50bfd78be5178dd9647e8517743dce224 100644 --- a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates.rb +++ b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates.rb @@ -5,71 +5,33 @@ module CastleGates mattr_accessor :exception_class self.exception_class = LockError - # - # This is a big hack to get around the horrible way that rails unloads everything in development mode. - # - # In typical development mode, without rails-dev-boost enabled, rails unloads every model after - # every request. It does this so that it can autoload models any time you reference the model anywhere. - # - # The problem is that once the model is unloaded, it no longer has acts_as_castle. - # So, we need to re-apply the permission definitions in dev mode. We do this by making the permissions - # defined in a class that we then set to be autoloadable, and we ensure it gets loaded on every request. - # # For example: # # CasteGates.initialize('config/permissions') # - # RAILS3_TODO - # - # In rails 3: - # * ActionController::Dispatcher.to_prepare is changed to ActionDispatch::Callbacks.to_prepare. - # * autoload is moved to ActiveSupport::Autoload - # def self.initialize(path) - file_name = File.basename(path) # e.g. 'permissions' - class_name = file_name.camelcase # e.g. 'Permissions' - - # - # require the permission definition file (this is only useful for testing mode) - # require "#{Rails.root}/#{path}" - - # - # make the class where permissions are defined (e.g. Permissions) autoloadable: - # - ActiveSupport::Dependencies.autoload_paths << "#{Rails.root}/#{File.dirname(path)}" - ActiveSupport::Dependencies.explicitly_unloadable_constants << class_name - - # - # Trigger autoload of Permissions class - # - ActionController::Dispatcher.to_prepare do - # everything in this block is run at the start of every request. - Kernel.const_get(class_name) - end end -end - -module CastleGates - class Permissions - def self.define(&block) - self.instance_eval(&block) - end + def self.define(&block) + self.instance_eval(&block) + end - def self.castle(model_class, &block) + def self.castle(model_class, &block) + after_reload(model_class) do |model_class| model_class.send(:acts_as_castle) model_class.class_eval(&block) end + end - def self.holder(*args, &block) - Holder::add_holder(*args, &block) - end + def self.holder(prefix, name, options=nil, &block) + Holder::add_holder(prefix, name, options, &block) + end - def self.holder_alias(name, options) - Holder::add_holder_alias(name, options[:model]) - end + def self.holder_alias(name, options) + Holder::add_holder_alias(name, options[:model]) end + end libraries = ['key', 'gate', 'gate_set', 'acts_as_castle', 'holder_definition', 'holder', 'acts_as_holder', 'associations'] diff --git a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/acts_as_holder.rb b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/acts_as_holder.rb index 7359e0b3220adc39643d19dcbc740173c29a6ca1..8ad2a8a72897d5acf10d0bd3fd68ef9fb5f7f5a5 100644 --- a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/acts_as_holder.rb +++ b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/acts_as_holder.rb @@ -1,37 +1,13 @@ # -# These modules are included in ActiveRecord objects that get registered as holders. +# This module is included in ActiveRecord objects that get registered as holders. # module CastleGates -module ActsAsHolder - - #def self.included(base) - # base.class_eval do - # def self.acts_as_holder() - # extend CastleGates::ActsAsHolder::ClassMethods - # include CastleGates::ActsAsHolder::InstanceMethods - # end - # end - #end - - module ClassMethods - def self.extended(base) - base.class_eval do - class << self - attr_accessor :holder_definition - end + module ActsAsHolder + module InstanceMethods + def holder_code_suffix + self.id end end end - - module InstanceMethods - def holder_definition - self.class.holder_definition - end - def holder_code_suffix - self.id - end - end - -end end diff --git a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/associations.rb b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/associations.rb index a3555c55ba63b6abf85e4636f51443ae492f075b..75c16981d5fe41608cbf9601022f182bc8a16ee6 100644 --- a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/associations.rb +++ b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/associations.rb @@ -24,8 +24,8 @@ class AssociationProxyProxy def initialize(proxy) @proxy = proxy end - def holder_definition - @proxy.reflection.holder_definition + def holder_class + @proxy.reflection.class end def holder_code_suffix @proxy.proxy_owner.id diff --git a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder.rb b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder.rb index 1841bbfb58024c93e25b284f8b4fd4b40229b477..b6b8dd23aa85426b4d953d91ebad85fe27851463 100644 --- a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder.rb +++ b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder.rb @@ -53,8 +53,10 @@ class Holder @definition ||= begin if @object.is_a? Symbol definition = self.class.holder_defs[@object] - elsif @object.respond_to? :holder_definition - definition = @object.holder_definition + elsif @object.respond_to?(:holder_class) + definition = self.class.holder_defs_by_class[@object.holder_class.name] + else + definition = self.class.holder_defs_by_class[@object.class.name] end raise ArgumentError.new("not a key holder: %s" % @object.inspect) unless definition definition @@ -142,9 +144,11 @@ class Holder # end # end # + # TODO: this is not actually used anymore, so maybe it should be ripped out. + # def association_with(castle) possible_holder = definition.associated.find do |hdef| - hdef.model == definition.model && hdef.association_model == castle.class.base_class + hdef.model.name == definition.model.name && hdef.association_model_name == castle.class.base_class.name end if possible_holder method_name = "#{possible_holder.name}?" @@ -166,9 +170,12 @@ class Holder class << self attr_reader :holder_defs attr_reader :holder_defs_by_prefix + attr_reader :holder_defs_by_class + end @holder_defs = {} @holder_defs_by_prefix = {} + @holder_defs_by_class = {} # # defines a new holder @@ -180,56 +187,28 @@ class Holder holder = nil if options[:model] - model = options[:model] - raise ArgumentError.new unless model.is_a?(Class) && model.ancestors.include?(ActiveRecord::Base) - model.send(:extend, CastleGates::ActsAsHolder::ClassMethods) - model.send(:include, CastleGates::ActsAsHolder::InstanceMethods) - holder = model + holder = holder_from_model(options) elsif options[:association] - association = options[:association] - raise ArgumentError.new unless association.is_a?(ActiveRecord::Reflection::MacroReflection) - association.class_eval do - def holder_code_suffix - proxy_owner.id - end - attr_accessor :holder_definition - end - options[:association_name] = association.name - options[:association_model] = association.active_record - options[:model] = association.klass - holder = association + holder = holder_from_association(options) elsif options[:abstract] - # eg :public + holder = name else raise ArgumentError.new(options.inspect) end - holder_def = HolderDefinition.new(name, options) - if holder.respond_to? :holder_definition - holder.holder_definition = holder_def - end - holder_defs[holder_def.name] = holder_def - holder_defs_by_prefix[holder_def.prefix] = holder_def + eval_block(block, options) - # add custom methods to the model - if block - model = options[:association_model] || options[:model] - if model - model.class_eval &block - end - end - return holder_def + create_holder_definition(holder, name, options) end # # allows multiple classes to share the same holder_definition # - def self.add_holder_alias(name, model) + def self.add_holder_alias(name, model_class) hdef = holder_defs[name] - raise ArgumentError.new('bad model') unless model.is_a?(Class) - model.send(:extend, CastleGates::ActsAsHolder::ClassMethods) - model.send(:include, CastleGates::ActsAsHolder::InstanceMethods) - model.holder_definition = hdef + raise ArgumentError.new('bad model') unless model_class.is_a?(Class) + holder_defs_by_class[model_class.name] = hdef + model_class.send(:include, CastleGates::ActsAsHolder::InstanceMethods) end # @@ -296,5 +275,58 @@ class Holder codes end + ## + ## HOLDER DEFINITION HELPERS + ## + + def self.create_holder_definition(holder, name, options) + holder_defs[name] ||= HolderDefinition.new(name, options) + hdef = holder_defs[name] + holder_defs_by_prefix[hdef.prefix] = hdef + if !holder.nil? + if holder.is_a?(Class) + holder_defs_by_class[holder.name] = hdef + elsif !holder.is_a?(Symbol) + holder_defs_by_class[holder.class.name] = hdef + end + end + hdef + end + + def self.eval_block(block, options) + if block + if model = (options[:association_model] || options[:model]) + after_reload(model) do |model| + model.class_eval &block + end + end + end + end + + def self.holder_from_model(options) + model = options[:model] + raise ArgumentError.new unless model.is_a?(Class) && model.ancestors.include?(ActiveRecord::Base) + after_reload(model) do |model| + model.send(:include, CastleGates::ActsAsHolder::InstanceMethods) + end + model + end + + def self.holder_from_association(options) + association = options[:association] + raise ArgumentError.new unless association.is_a?(ActiveRecord::Reflection::MacroReflection) + after_reload(association.class) do |klass| + klass.class_eval do + def holder_code_suffix + proxy_owner.id + end + end + end + options[:association_name] = association.name + options[:association_model] = association.active_record + options[:model] = association.klass + association + end + end end diff --git a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder_definition.rb b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder_definition.rb index 42be4fdedc8750727bfb74117e6820e71e52d35d..3155a9c5165c4ad6a0de44acbab8f7227fe35610 100644 --- a/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder_definition.rb +++ b/vendor/crabgrass_plugins/castle_gates/lib/castle_gates/holder_definition.rb @@ -22,9 +22,9 @@ class HolderDefinition attr_reader :model # active record class, if any attr_reader :association_name # name of association, like 'friends' if model has_many :friends - attr_reader :association_model # active record class of the other side of the association. - # for example, for holder Group.associated(:users), User is the model, - # 'users' is the association_name, and Group is the associated_model. + attr_reader :association_model_name # active record class name of the other side of the association. + # for example, for holder Group.associated(:users), User is the model, + # 'users' is the association_name, and "Group" is the associated_model_name. attr_reader :associated # an array of other holder definitions @@ -36,23 +36,23 @@ class HolderDefinition @label = options[:label] || @name @model = options[:model] @association_name = options[:association_name] - @association_model = options[:association_model] + @association_model_name = options[:association_model].name if options[:association_model] @associated = [] # # add association links (used for resolving default bitfield values) # - if @association_model + if @association_model_name # if this is an association model, add to previously defined non-association defs. Holder.holder_defs.each do |name, hdef| - if !hdef.association_model && (hdef.model == @model || hdef.model == @association_model) + if !hdef.association_model_name && hdef.model && (hdef.model.name == @model.name || hdef.model.name == @association_model_name) hdef.associated << self end end elsif @model # if this is a regular model, add to previously defined association defs. Holder.holder_defs.each do |name, hdef| - if hdef.association_model && (hdef.model == @model || hdef.association_model == @model) + if hdef.association_model_name && hdef.model && (hdef.model.name == @model.name || hdef.association_model_name == @model.name) hdef.associated << self end end @@ -61,7 +61,7 @@ class HolderDefinition def get_holder_from_id(id) if association_name - association_model.find(id).associated(association_name) + association_model_name.constantize.find(id).associated(association_name) elsif model model.find(id) elsif abstract diff --git a/vendor/crabgrass_plugins/castle_gates/test/models.rb b/vendor/crabgrass_plugins/castle_gates/test/models.rb index 72ad0550ec72ac8bdc51937b27478a315114fef5..4d0fc4498aa3246cb1eafb4a4ba9a8b41a8fa18f 100644 --- a/vendor/crabgrass_plugins/castle_gates/test/models.rb +++ b/vendor/crabgrass_plugins/castle_gates/test/models.rb @@ -74,7 +74,7 @@ end class Rabbit end -class Permissions < CastleGates::Permissions +CastleGates.define do castle Fort do gate 1, :draw_bridge diff --git a/vendor/crabgrass_plugins/castle_gates/test/test.rb b/vendor/crabgrass_plugins/castle_gates/test/test.rb index 182231b5dbd1e80deff5197cc102c6bebe1ab0d4..93b83e4b99cbf459da979beee7d46cb2356e015a 100644 --- a/vendor/crabgrass_plugins/castle_gates/test/test.rb +++ b/vendor/crabgrass_plugins/castle_gates/test/test.rb @@ -31,6 +31,13 @@ SHOW_SQL = false ## TEST HELPERS ## +class Object + private + def after_reload(model, &block) + yield model + end +end + ['../init', 'setup_db', 'models', 'fixtures'].each do |file| require "#{File.dirname(__FILE__)}/" + file end