wheels 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/controllers/access_control_entries_controller.rb +19 -0
- data/app/controllers/discussions_controller.rb +10 -0
- data/app/controllers/forum_messages_controller.rb +13 -0
- data/app/controllers/forums_controller.rb +2 -0
- data/app/controllers/pages_controller.rb +1 -1
- data/app/helpers/access_control_entries_helper.rb +2 -0
- data/app/helpers/discussions_helper.rb +2 -0
- data/app/helpers/forums_helper.rb +2 -0
- data/app/models/access_control_entry.rb +84 -0
- data/app/models/discussion.rb +19 -0
- data/app/models/forum.rb +4 -0
- data/app/models/forum_message.rb +5 -0
- data/app/models/role.rb +1 -0
- data/app/models/user.rb +3 -5
- data/app/views/access_control_entries/_form.html.haml +27 -0
- data/app/views/access_control_entries/edit.html.haml +7 -0
- data/app/views/access_control_entries/index.html.haml +29 -0
- data/app/views/access_control_entries/new.html.haml +5 -0
- data/app/views/access_control_entries/show.html.haml +22 -0
- data/app/views/discussions/_form.html.haml +16 -0
- data/app/views/discussions/edit.html.haml +7 -0
- data/app/views/discussions/index.html.haml +10 -0
- data/app/views/discussions/new.html.haml +25 -0
- data/app/views/discussions/show.html.haml +16 -0
- data/app/views/forum_messages/_form.html.haml +6 -0
- data/app/views/forum_messages/index.html.haml +11 -0
- data/app/views/forum_messages/new.html.haml +5 -0
- data/app/views/forums/_form.html.haml +13 -0
- data/app/views/forums/edit.html.haml +7 -0
- data/app/views/forums/index.html.haml +26 -0
- data/app/views/forums/new.html.haml +5 -0
- data/app/views/forums/show.html.haml +21 -0
- data/app/views/pages/index.html.haml +5 -19
- data/app/views/pages/show.html.haml +2 -2
- data/lib/wheels/routes.rb +17 -3
- data/wheels.gemspec +30 -1
- metadata +32 -3
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.0. | 
| 1 | 
            +
            0.0.19
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            class AccessControlEntriesController < InheritedResources::Base
         | 
| 2 | 
            +
              before_filter :authenticate!
         | 
| 3 | 
            +
              has_scope :by_resource, :using => [:class, :resource_id]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              def collection
         | 
| 6 | 
            +
                @access_control_entries ||= load_resource
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              private
         | 
| 10 | 
            +
                def load_resource
         | 
| 11 | 
            +
                  if params[:id]
         | 
| 12 | 
            +
                    AccessControlEntry.find(params[:id])
         | 
| 13 | 
            +
                  else
         | 
| 14 | 
            +
                    raise "No resource id supplied" unless params[:class]
         | 
| 15 | 
            +
                    AccessControlEntry.find_by_resource_class_name_and_resource_id params[:class], params[:resource_id]
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
            end
         | 
| 19 | 
            +
             | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            class ForumMessagesController < InheritedResources::Base
         | 
| 2 | 
            +
              belongs_to :forum, :discussion
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              resource_attributes({:author => :current_user})
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def create
         | 
| 7 | 
            +
                create! {forum_discussion_path(@discussion.forum, @discussion)}
         | 
| 8 | 
            +
              end
         | 
| 9 | 
            +
              def update
         | 
| 10 | 
            +
                update! {forum_discussion_path(@discussion.forum, @discussion)}
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
| 13 | 
            +
             | 
| @@ -4,7 +4,7 @@ class PagesController < InheritedResources::Base | |
| 4 4 | 
             
                if page_id.is_numeric?
         | 
| 5 5 | 
             
                  @page ||= Page.find(page_id)
         | 
| 6 6 | 
             
                else
         | 
| 7 | 
            -
                  @page ||= Page.where(["pages.title | 
| 7 | 
            +
                  @page ||= Page.where(["lower(pages.title) = ?", page_id.downcase.gsub(/[_]/, ' ')]).first
         | 
| 8 8 | 
             
                end
         | 
| 9 9 | 
             
              end
         | 
| 10 10 | 
             
            end
         | 
| @@ -0,0 +1,84 @@ | |
| 1 | 
            +
            class AccessControlEntry < ActiveRecord::Base
         | 
| 2 | 
            +
              belongs_to :user
         | 
| 3 | 
            +
              belongs_to :role
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              scope :by_resource, lambda {|resource_class_name, resource_id|
         | 
| 6 | 
            +
                where(:resource_class_name=>resource_class_name).
         | 
| 7 | 
            +
                where(:resource_id=>resource_id)
         | 
| 8 | 
            +
              }
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              def resource
         | 
| 11 | 
            +
                @resource ||= (resource_id.nil? ? self.resource_class_name.constantize :
         | 
| 12 | 
            +
                              self.resource_class_name.constantize.find(self.resource_id))
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def resource=(res)
         | 
| 16 | 
            +
                @resource = res
         | 
| 17 | 
            +
                if res.type==Class
         | 
| 18 | 
            +
                  self.resource_id = nil
         | 
| 19 | 
            +
                  self.resource_class_name = res.name
         | 
| 20 | 
            +
                else
         | 
| 21 | 
            +
                  self.resource_id = res.id
         | 
| 22 | 
            +
                  self.resource_class_name = res.class.name
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              def options
         | 
| 27 | 
            +
                @options ||= eval(self.serialized_options)
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              def options=(opts)
         | 
| 31 | 
            +
                raise "I only take hash" unless opts.class==Hash
         | 
| 32 | 
            +
                klasses = %w(String Symbol)
         | 
| 33 | 
            +
                opts.delete_if{|u,v| !klasses.include?(u.class.name) || !klasses.include?(v.class.name)}
         | 
| 34 | 
            +
                @options = opts
         | 
| 35 | 
            +
                self.serialized_options = opts.inspect
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              def configure(ability)
         | 
| 39 | 
            +
                ability.send method_name, verb, resource, options
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              def self.can(verb, resource, options={})
         | 
| 43 | 
            +
                AccessControlEntry.new(true, verb, resource, options )
         | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
              def self.cannot(verb, resource, options)
         | 
| 46 | 
            +
                AccessControlEntry.new(false, verb, resource, options )
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              def initialize(can, verb, resource, options={})
         | 
| 50 | 
            +
                @options = options
         | 
| 51 | 
            +
                self.can = can
         | 
| 52 | 
            +
                self.verb = verb
         | 
| 53 | 
            +
                self.resource = resource
         | 
| 54 | 
            +
                self.options = options
         | 
| 55 | 
            +
              end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
              def method_name
         | 
| 58 | 
            +
                self.can ? :can : :cannot
         | 
| 59 | 
            +
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
              def user_email
         | 
| 62 | 
            +
                self.user.email if self.user
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
              def user_email=(email)
         | 
| 65 | 
            +
                self.user = User.find_by_email(email) unless email.blank?
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
              def role=(role)
         | 
| 69 | 
            +
                if role.kind_of? Role
         | 
| 70 | 
            +
                  self.role_id = role.id
         | 
| 71 | 
            +
                else
         | 
| 72 | 
            +
                  role = role.to_s.camelize
         | 
| 73 | 
            +
                  if role.is_numeric?
         | 
| 74 | 
            +
                    self.role_id= role
         | 
| 75 | 
            +
                  else
         | 
| 76 | 
            +
                    self.role_id= Role.find_by_name(role).id
         | 
| 77 | 
            +
                  end
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
              end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
              attr_protected :serialized_options
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            end
         | 
| 84 | 
            +
             | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            class Discussion < ActiveRecord::Base
         | 
| 2 | 
            +
              belongs_to :forum
         | 
| 3 | 
            +
              has_many :forum_messages
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              attr_accessor :new_message
         | 
| 6 | 
            +
              after_save :save_new_message
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              def save_new_message
         | 
| 9 | 
            +
                self.new_message.save if self.new_message
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def new_message_attributes=(attributes)
         | 
| 13 | 
            +
                unless attributes["body"].blank?
         | 
| 14 | 
            +
                  self.new_message ||= ForumMessage.new(:discussion=>self)
         | 
| 15 | 
            +
                  self.new_message.attributes = attributes
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
| 19 | 
            +
             | 
    
        data/app/models/forum.rb
    ADDED
    
    
    
        data/app/models/role.rb
    CHANGED
    
    
    
        data/app/models/user.rb
    CHANGED
    
    | @@ -1,12 +1,12 @@ | |
| 1 1 | 
             
            class User < ActiveRecord::Base
         | 
| 2 | 
            -
               | 
| 2 | 
            +
              after_create :create_profile
         | 
| 3 3 | 
             
              belongs_to :role
         | 
| 4 4 | 
             
              has_many :blogs, :dependent => :destroy
         | 
| 5 5 | 
             
              has_one :profile, :dependent => :destroy
         | 
| 6 6 | 
             
              has_many :galleries, :dependent => :destroy
         | 
| 7 7 |  | 
| 8 8 | 
             
              def create_profile
         | 
| 9 | 
            -
                 | 
| 9 | 
            +
                Profile.create(:user=>self) unless self.profile
         | 
| 10 10 | 
             
              end
         | 
| 11 11 |  | 
| 12 12 | 
             
              def role?(role)
         | 
| @@ -39,9 +39,7 @@ class User < ActiveRecord::Base | |
| 39 39 |  | 
| 40 40 | 
             
              # Include default devise modules. Others available are:
         | 
| 41 41 | 
             
              # :token_authenticatable, :confirmable, :lockable and :timeoutable
         | 
| 42 | 
            -
              devise :database_authenticatable, :registerable,
         | 
| 43 | 
            -
                     :recoverable, :rememberable, :trackable, :validatable,
         | 
| 44 | 
            -
                     :token_authenticatable, :confirmable, :lockable, :timeoutable
         | 
| 42 | 
            +
              devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :confirmable, :lockable, :timeoutable
         | 
| 45 43 |  | 
| 46 44 | 
             
              # Setup accessible (or protected) attributes for your model
         | 
| 47 45 | 
             
              attr_accessible :email, :password, :password_confirmation
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            = form_for @access_control_entry do |f|
         | 
| 2 | 
            +
              -if @access_control_entry.errors.any?
         | 
| 3 | 
            +
                #errorExplanation
         | 
| 4 | 
            +
                  %h2= "#{pluralize(@access_control_entry.errors.count, "error")} prohibited this access_control_entry from being saved:"
         | 
| 5 | 
            +
                  %ul
         | 
| 6 | 
            +
                    - @access_control_entry.errors.full_messages.each do |msg|
         | 
| 7 | 
            +
                      %li= msg
         | 
| 8 | 
            +
              %ul.form_fields
         | 
| 9 | 
            +
                %li
         | 
| 10 | 
            +
                  = f.label :resource_class_name
         | 
| 11 | 
            +
                  = f.select :resource_class_name, [["Forum", "Forum"], ["Page", "Page"]]
         | 
| 12 | 
            +
                  = f.hidden_field :resource_id
         | 
| 13 | 
            +
                %li
         | 
| 14 | 
            +
                  = f.label :user_email
         | 
| 15 | 
            +
                  = f.text_field :user_email
         | 
| 16 | 
            +
                %li
         | 
| 17 | 
            +
                  = f.label :role
         | 
| 18 | 
            +
                  = f.select :role, ["Admin", "User", "Nobody"]
         | 
| 19 | 
            +
                %li
         | 
| 20 | 
            +
                  = f.label :can
         | 
| 21 | 
            +
                  = f.check_box :can
         | 
| 22 | 
            +
                %li
         | 
| 23 | 
            +
                  = f.label :verb
         | 
| 24 | 
            +
                  = f.text_field :verb
         | 
| 25 | 
            +
                %li
         | 
| 26 | 
            +
                  = f.submit 'Save'
         | 
| 27 | 
            +
             | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            %h1 Listing access_control_entries
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            %table
         | 
| 4 | 
            +
              %tr
         | 
| 5 | 
            +
                %th Resource class name
         | 
| 6 | 
            +
                %th Resource
         | 
| 7 | 
            +
                %th User
         | 
| 8 | 
            +
                %th Role
         | 
| 9 | 
            +
                %th Can
         | 
| 10 | 
            +
                %th Verb
         | 
| 11 | 
            +
                %th
         | 
| 12 | 
            +
                %th
         | 
| 13 | 
            +
                %th
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              - @access_control_entries.each do |access_control_entry|
         | 
| 16 | 
            +
                %tr
         | 
| 17 | 
            +
                  %td= access_control_entry.resource_class_name
         | 
| 18 | 
            +
                  %td= access_control_entry.resource_id
         | 
| 19 | 
            +
                  %td= access_control_entry.user_id
         | 
| 20 | 
            +
                  %td= access_control_entry.role_id
         | 
| 21 | 
            +
                  %td= access_control_entry.can
         | 
| 22 | 
            +
                  %td= access_control_entry.verb
         | 
| 23 | 
            +
                  %td= link_to 'Show', access_control_entry
         | 
| 24 | 
            +
                  %td= link_to 'Edit', edit_access_control_entry_path(access_control_entry)
         | 
| 25 | 
            +
                  %td= link_to 'Destroy', access_control_entry, :confirm => 'Are you sure?', :method => :delete
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            %br
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            = link_to 'New access_control_entry', new_access_control_entry_path
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            %p
         | 
| 2 | 
            +
              %b Resource class name:
         | 
| 3 | 
            +
              = @access_control_entry.resource_class_name
         | 
| 4 | 
            +
            %p
         | 
| 5 | 
            +
              %b Resource:
         | 
| 6 | 
            +
              = @access_control_entry.resource_id
         | 
| 7 | 
            +
            %p
         | 
| 8 | 
            +
              %b User:
         | 
| 9 | 
            +
              = @access_control_entry.user_id
         | 
| 10 | 
            +
            %p
         | 
| 11 | 
            +
              %b Role:
         | 
| 12 | 
            +
              = @access_control_entry.role_id
         | 
| 13 | 
            +
            %p
         | 
| 14 | 
            +
              %b Can:
         | 
| 15 | 
            +
              = @access_control_entry.can
         | 
| 16 | 
            +
            %p
         | 
| 17 | 
            +
              %b Verb:
         | 
| 18 | 
            +
              = @access_control_entry.verb
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            = link_to 'Edit', edit_access_control_entry_path(@access_control_entry)
         | 
| 21 | 
            +
            \|
         | 
| 22 | 
            +
            = link_to 'Back', access_control_entries_path
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            = form_for @discussion do |f|
         | 
| 2 | 
            +
              -if @discussion.errors.any?
         | 
| 3 | 
            +
                #errorExplanation
         | 
| 4 | 
            +
                  %h2= "#{pluralize(@discussion.errors.count, "error")} prohibited this discussion from being saved:"
         | 
| 5 | 
            +
                  %ul
         | 
| 6 | 
            +
                    - @discussion.errors.full_messages.each do |msg|
         | 
| 7 | 
            +
                      %li= msg
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              .field
         | 
| 10 | 
            +
                = f.label :subject
         | 
| 11 | 
            +
                = f.text_field :subject
         | 
| 12 | 
            +
              .field
         | 
| 13 | 
            +
                = f.label :forum_id
         | 
| 14 | 
            +
                = f.text_field :forum_id
         | 
| 15 | 
            +
              .actions
         | 
| 16 | 
            +
                = f.submit 'Save'
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            %h1 Listing discussions in forum #{@forum.name}
         | 
| 2 | 
            +
            = link_to 'New discussion', new_resource_url if can? :create, Discussion, :forum_id=>@forum.id
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            %ul
         | 
| 5 | 
            +
              - for discussion in @discussions.sort{|u,v| u.updated_at <=> v.update_at}
         | 
| 6 | 
            +
                %li
         | 
| 7 | 
            +
                  = link_to discussion.subject, url_for([@forum, discussion])
         | 
| 8 | 
            +
                  - if can? :manage, discussion
         | 
| 9 | 
            +
                    = link_to "Manage", edit_forum_discussion_path(@forum, discussion)
         | 
| 10 | 
            +
             | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            %h1 New discussion
         | 
| 2 | 
            +
            - include_ckeditor
         | 
| 3 | 
            +
            = form_for [@forum, @discussion] do |f|
         | 
| 4 | 
            +
              -if @discussion.errors.any?
         | 
| 5 | 
            +
                #errorExplanation
         | 
| 6 | 
            +
                  %h2= "#{pluralize(@discussion.errors.count, "error")} prohibited this discussion from being saved:"
         | 
| 7 | 
            +
                  %ul
         | 
| 8 | 
            +
                    - @discussion.errors.full_messages.each do |msg|
         | 
| 9 | 
            +
                      %li= msg
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              %ul.form_fields
         | 
| 12 | 
            +
                %li.field
         | 
| 13 | 
            +
                  = f.label :subject
         | 
| 14 | 
            +
                  = f.text_field :subject
         | 
| 15 | 
            +
                  = f.hidden_field :forum_id
         | 
| 16 | 
            +
                %li.field
         | 
| 17 | 
            +
                  = f.fields_for :new_message, @new_message do |ff|
         | 
| 18 | 
            +
                    = ff.hidden_field :author_id
         | 
| 19 | 
            +
                    %ul.form_fields
         | 
| 20 | 
            +
                      %li.field= ff.text_area :message, :class=>'ckeditor_textarea'
         | 
| 21 | 
            +
              .actions
         | 
| 22 | 
            +
                = f.submit 'Create new discussion'
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            = link_to 'Back', collection_url
         | 
| 25 | 
            +
             | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            %h2 #{@forum.name} > #{@discussion.subject}
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            %ul
         | 
| 4 | 
            +
              - for message in @discussion.forum_messages
         | 
| 5 | 
            +
                %li
         | 
| 6 | 
            +
                  .named_box
         | 
| 7 | 
            +
                    .box_title
         | 
| 8 | 
            +
                      Posted By #{message.author.email} on #{message.updated_at}
         | 
| 9 | 
            +
                    .box_content!= message.message
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            = content_for :links do
         | 
| 12 | 
            +
              %ul
         | 
| 13 | 
            +
                - if can? :create, Discussion, :forum_id=>@forum.id
         | 
| 14 | 
            +
                  %li= link_to "Reply to this discussion", new_forum_discussion_forum_message_path(@forum, @discussion)
         | 
| 15 | 
            +
                %li= link_to 'Back to Forum', @forum
         | 
| 16 | 
            +
             | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            %h1 Messages in #{@discussion.subject}
         | 
| 2 | 
            +
            - if can? :create, Discussion, :forum_id=>@discussion.forum.id
         | 
| 3 | 
            +
              = link_to "Reply to this topic", new_resource_url
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            %ul.listing
         | 
| 6 | 
            +
              - for message in @forum_messages
         | 
| 7 | 
            +
                %li
         | 
| 8 | 
            +
                  .content_box
         | 
| 9 | 
            +
                    .box_title Posted By #{message.author.email} on #{message.created_at}
         | 
| 10 | 
            +
                    .box_content!= message.message
         | 
| 11 | 
            +
             | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            = form_for @forum do |f|
         | 
| 2 | 
            +
              -if @forum.errors.any?
         | 
| 3 | 
            +
                #errorExplanation
         | 
| 4 | 
            +
                  %h2= "#{pluralize(@forum.errors.count, "error")} prohibited this forum from being saved:"
         | 
| 5 | 
            +
                  %ul
         | 
| 6 | 
            +
                    - @forum.errors.full_messages.each do |msg|
         | 
| 7 | 
            +
                      %li= msg
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              .field
         | 
| 10 | 
            +
                = f.label :name
         | 
| 11 | 
            +
                = f.text_field :name
         | 
| 12 | 
            +
              .actions
         | 
| 13 | 
            +
                = f.submit 'Save'
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            %h1 Listing forums
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            %ul
         | 
| 4 | 
            +
              - @forums.each do |forum|
         | 
| 5 | 
            +
                - if can? :read, forum
         | 
| 6 | 
            +
                  %li
         | 
| 7 | 
            +
                    = link_to forum.name, forum
         | 
| 8 | 
            +
                    - if can? :create, Discussion, :forum_id=>forum.id
         | 
| 9 | 
            +
                      = link_to "New Topic", new_forum_discussion_path(forum)
         | 
| 10 | 
            +
                    - if can? :manage, forum
         | 
| 11 | 
            +
                      = link_to "Manage Forum", edit_forum_path(forum)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            - if can? :create, Forum
         | 
| 14 | 
            +
              %h2 Open a New Forum
         | 
| 15 | 
            +
              = form_for Forum.new do |f|
         | 
| 16 | 
            +
                %ul.form_fields
         | 
| 17 | 
            +
                  %li.field
         | 
| 18 | 
            +
                    Name:
         | 
| 19 | 
            +
                    = f.text_field :name
         | 
| 20 | 
            +
                  %li.action
         | 
| 21 | 
            +
                    = f.submit
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            = content_for :links do
         | 
| 24 | 
            +
              %ul
         | 
| 25 | 
            +
                %li= link_to 'New forum', new_forum_path if can? :create, Forum
         | 
| 26 | 
            +
             | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            %h1 Forum: #{@forum.name}
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            .titled_box
         | 
| 4 | 
            +
              .box_title Discussions in this forum
         | 
| 5 | 
            +
              .box_contents
         | 
| 6 | 
            +
                %ul
         | 
| 7 | 
            +
                  - for discussion in @forum.discussions.sort{|u,v| u.updated_at <=> v.update_at}
         | 
| 8 | 
            +
                    %li
         | 
| 9 | 
            +
                      = link_to discussion.subject, url_for([@forum, discussion])
         | 
| 10 | 
            +
                      - if can? :create, Discussion, :forum_id => @forum.id
         | 
| 11 | 
            +
                        = link_to "Reply to this topic", new_forum_discussion_forum_message_path(@forum, discussion)
         | 
| 12 | 
            +
                      - if can? :manage, discussion
         | 
| 13 | 
            +
                        = link_to "Manage", edit_forum_discussion_path(@forum, discussion)
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            = content_for :links do
         | 
| 16 | 
            +
              %ul
         | 
| 17 | 
            +
                - if can? :create, Discussion, :forum_id=>@forum.id
         | 
| 18 | 
            +
                  %li= link_to "New topic in this forum", new_forum_discussion_path(@forum)
         | 
| 19 | 
            +
                - if can? :manage, @forum
         | 
| 20 | 
            +
                  %li= link_to 'Edit', edit_forum_path(@forum)
         | 
| 21 | 
            +
             | 
| @@ -1,21 +1,7 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            = link_to 'New page', new_page_path if can? :create, Page
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
              % | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
                %th
         | 
| 8 | 
            -
                %th
         | 
| 9 | 
            -
                %th
         | 
| 3 | 
            +
            - @pages.each do |page|
         | 
| 4 | 
            +
              %h1= link_to page.title, page
         | 
| 5 | 
            +
              = link_to "Edit", edit_page_path(page) if can? :edit, page
         | 
| 6 | 
            +
              .page_content!= page.body[0..5000]
         | 
| 10 7 |  | 
| 11 | 
            -
              - @pages.each do |page|
         | 
| 12 | 
            -
                %tr
         | 
| 13 | 
            -
                  %td= page.title
         | 
| 14 | 
            -
                  %td= page.body
         | 
| 15 | 
            -
                  %td= link_to 'Show', page
         | 
| 16 | 
            -
                  %td= link_to 'Edit', edit_page_path(page)
         | 
| 17 | 
            -
                  %td= link_to 'Destroy', page, :confirm => 'Are you sure?', :method => :delete
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            %br
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            = link_to 'New page', new_page_path
         | 
    
        data/lib/wheels/routes.rb
    CHANGED
    
    | @@ -12,13 +12,27 @@ module ActionDispatch::Routing | |
| 12 12 | 
             
                  resources :users do
         | 
| 13 13 | 
             
                    resource :profile
         | 
| 14 14 | 
             
                    resources :galleries
         | 
| 15 | 
            -
                    resources :blogs, :path=>"blog" | 
| 16 | 
            -
             | 
| 15 | 
            +
                    resources :blogs, :path=>"blog"
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  resources :layouts
         | 
| 19 | 
            +
                  resources :forums do
         | 
| 20 | 
            +
                    resources :discussions do
         | 
| 21 | 
            +
                      resources :forum_messages
         | 
| 17 22 | 
             
                    end
         | 
| 18 23 | 
             
                  end
         | 
| 19 | 
            -
             | 
| 24 | 
            +
             | 
| 25 | 
            +
                  resources :pages, :only => [:index, :show]
         | 
| 26 | 
            +
                  resources :product_revisions
         | 
| 27 | 
            +
                  scope "/publish" do
         | 
| 28 | 
            +
                    resources :pages
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  scope "/admin" do
         | 
| 32 | 
            +
                    resources :access_control_entries
         | 
| 20 33 | 
             
                    resources :users
         | 
| 21 34 | 
             
                  end
         | 
| 35 | 
            +
             | 
| 22 36 | 
             
                end
         | 
| 23 37 | 
             
              end
         | 
| 24 38 | 
             
            end
         | 
    
        data/wheels.gemspec
    CHANGED
    
    | @@ -5,7 +5,7 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{wheels}
         | 
| 8 | 
            -
              s.version = "0.0. | 
| 8 | 
            +
              s.version = "0.0.19"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Tyler Gannon"]
         | 
| @@ -20,16 +20,27 @@ Gem::Specification.new do |s| | |
| 20 20 | 
             
                 "README.rdoc",
         | 
| 21 21 | 
             
                 "Rakefile",
         | 
| 22 22 | 
             
                 "VERSION",
         | 
| 23 | 
            +
                 "app/controllers/access_control_entries_controller.rb",
         | 
| 23 24 | 
             
                 "app/controllers/blogs_controller.rb",
         | 
| 25 | 
            +
                 "app/controllers/discussions_controller.rb",
         | 
| 26 | 
            +
                 "app/controllers/forum_messages_controller.rb",
         | 
| 27 | 
            +
                 "app/controllers/forums_controller.rb",
         | 
| 24 28 | 
             
                 "app/controllers/galleries_controller.rb",
         | 
| 25 29 | 
             
                 "app/controllers/images_controller.rb",
         | 
| 26 30 | 
             
                 "app/controllers/pages_controller.rb",
         | 
| 27 31 | 
             
                 "app/controllers/profiles_controller.rb",
         | 
| 28 32 | 
             
                 "app/controllers/users_controller.rb",
         | 
| 33 | 
            +
                 "app/helpers/access_control_entries_helper.rb",
         | 
| 29 34 | 
             
                 "app/helpers/blogs_helper.rb",
         | 
| 35 | 
            +
                 "app/helpers/discussions_helper.rb",
         | 
| 36 | 
            +
                 "app/helpers/forums_helper.rb",
         | 
| 30 37 | 
             
                 "app/helpers/pages_helper.rb",
         | 
| 31 38 | 
             
                 "app/models/ability.rb",
         | 
| 39 | 
            +
                 "app/models/access_control_entry.rb",
         | 
| 32 40 | 
             
                 "app/models/blog.rb",
         | 
| 41 | 
            +
                 "app/models/discussion.rb",
         | 
| 42 | 
            +
                 "app/models/forum.rb",
         | 
| 43 | 
            +
                 "app/models/forum_message.rb",
         | 
| 33 44 | 
             
                 "app/models/gallery.rb",
         | 
| 34 45 | 
             
                 "app/models/image.rb",
         | 
| 35 46 | 
             
                 "app/models/page.rb",
         | 
| @@ -38,12 +49,30 @@ Gem::Specification.new do |s| | |
| 38 49 | 
             
                 "app/models/role.rb",
         | 
| 39 50 | 
             
                 "app/models/tagging.rb",
         | 
| 40 51 | 
             
                 "app/models/user.rb",
         | 
| 52 | 
            +
                 "app/views/access_control_entries/_form.html.haml",
         | 
| 53 | 
            +
                 "app/views/access_control_entries/edit.html.haml",
         | 
| 54 | 
            +
                 "app/views/access_control_entries/index.html.haml",
         | 
| 55 | 
            +
                 "app/views/access_control_entries/new.html.haml",
         | 
| 56 | 
            +
                 "app/views/access_control_entries/show.html.haml",
         | 
| 41 57 | 
             
                 "app/views/blogs/_form.html.haml",
         | 
| 42 58 | 
             
                 "app/views/blogs/edit.html.haml",
         | 
| 43 59 | 
             
                 "app/views/blogs/index.html.haml",
         | 
| 44 60 | 
             
                 "app/views/blogs/index.xml.builder",
         | 
| 45 61 | 
             
                 "app/views/blogs/new.html.haml",
         | 
| 46 62 | 
             
                 "app/views/blogs/show.html.haml",
         | 
| 63 | 
            +
                 "app/views/discussions/_form.html.haml",
         | 
| 64 | 
            +
                 "app/views/discussions/edit.html.haml",
         | 
| 65 | 
            +
                 "app/views/discussions/index.html.haml",
         | 
| 66 | 
            +
                 "app/views/discussions/new.html.haml",
         | 
| 67 | 
            +
                 "app/views/discussions/show.html.haml",
         | 
| 68 | 
            +
                 "app/views/forum_messages/_form.html.haml",
         | 
| 69 | 
            +
                 "app/views/forum_messages/index.html.haml",
         | 
| 70 | 
            +
                 "app/views/forum_messages/new.html.haml",
         | 
| 71 | 
            +
                 "app/views/forums/_form.html.haml",
         | 
| 72 | 
            +
                 "app/views/forums/edit.html.haml",
         | 
| 73 | 
            +
                 "app/views/forums/index.html.haml",
         | 
| 74 | 
            +
                 "app/views/forums/new.html.haml",
         | 
| 75 | 
            +
                 "app/views/forums/show.html.haml",
         | 
| 47 76 | 
             
                 "app/views/galleries/_form.html.haml",
         | 
| 48 77 | 
             
                 "app/views/galleries/_show.html.haml",
         | 
| 49 78 | 
             
                 "app/views/galleries/edit.html.haml",
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: wheels
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 57
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 0
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.0. | 
| 9 | 
            +
              - 19
         | 
| 10 | 
            +
              version: 0.0.19
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Tyler Gannon
         | 
| @@ -45,16 +45,27 @@ files: | |
| 45 45 | 
             
            - README.rdoc
         | 
| 46 46 | 
             
            - Rakefile
         | 
| 47 47 | 
             
            - VERSION
         | 
| 48 | 
            +
            - app/controllers/access_control_entries_controller.rb
         | 
| 48 49 | 
             
            - app/controllers/blogs_controller.rb
         | 
| 50 | 
            +
            - app/controllers/discussions_controller.rb
         | 
| 51 | 
            +
            - app/controllers/forum_messages_controller.rb
         | 
| 52 | 
            +
            - app/controllers/forums_controller.rb
         | 
| 49 53 | 
             
            - app/controllers/galleries_controller.rb
         | 
| 50 54 | 
             
            - app/controllers/images_controller.rb
         | 
| 51 55 | 
             
            - app/controllers/pages_controller.rb
         | 
| 52 56 | 
             
            - app/controllers/profiles_controller.rb
         | 
| 53 57 | 
             
            - app/controllers/users_controller.rb
         | 
| 58 | 
            +
            - app/helpers/access_control_entries_helper.rb
         | 
| 54 59 | 
             
            - app/helpers/blogs_helper.rb
         | 
| 60 | 
            +
            - app/helpers/discussions_helper.rb
         | 
| 61 | 
            +
            - app/helpers/forums_helper.rb
         | 
| 55 62 | 
             
            - app/helpers/pages_helper.rb
         | 
| 56 63 | 
             
            - app/models/ability.rb
         | 
| 64 | 
            +
            - app/models/access_control_entry.rb
         | 
| 57 65 | 
             
            - app/models/blog.rb
         | 
| 66 | 
            +
            - app/models/discussion.rb
         | 
| 67 | 
            +
            - app/models/forum.rb
         | 
| 68 | 
            +
            - app/models/forum_message.rb
         | 
| 58 69 | 
             
            - app/models/gallery.rb
         | 
| 59 70 | 
             
            - app/models/image.rb
         | 
| 60 71 | 
             
            - app/models/page.rb
         | 
| @@ -63,12 +74,30 @@ files: | |
| 63 74 | 
             
            - app/models/role.rb
         | 
| 64 75 | 
             
            - app/models/tagging.rb
         | 
| 65 76 | 
             
            - app/models/user.rb
         | 
| 77 | 
            +
            - app/views/access_control_entries/_form.html.haml
         | 
| 78 | 
            +
            - app/views/access_control_entries/edit.html.haml
         | 
| 79 | 
            +
            - app/views/access_control_entries/index.html.haml
         | 
| 80 | 
            +
            - app/views/access_control_entries/new.html.haml
         | 
| 81 | 
            +
            - app/views/access_control_entries/show.html.haml
         | 
| 66 82 | 
             
            - app/views/blogs/_form.html.haml
         | 
| 67 83 | 
             
            - app/views/blogs/edit.html.haml
         | 
| 68 84 | 
             
            - app/views/blogs/index.html.haml
         | 
| 69 85 | 
             
            - app/views/blogs/index.xml.builder
         | 
| 70 86 | 
             
            - app/views/blogs/new.html.haml
         | 
| 71 87 | 
             
            - app/views/blogs/show.html.haml
         | 
| 88 | 
            +
            - app/views/discussions/_form.html.haml
         | 
| 89 | 
            +
            - app/views/discussions/edit.html.haml
         | 
| 90 | 
            +
            - app/views/discussions/index.html.haml
         | 
| 91 | 
            +
            - app/views/discussions/new.html.haml
         | 
| 92 | 
            +
            - app/views/discussions/show.html.haml
         | 
| 93 | 
            +
            - app/views/forum_messages/_form.html.haml
         | 
| 94 | 
            +
            - app/views/forum_messages/index.html.haml
         | 
| 95 | 
            +
            - app/views/forum_messages/new.html.haml
         | 
| 96 | 
            +
            - app/views/forums/_form.html.haml
         | 
| 97 | 
            +
            - app/views/forums/edit.html.haml
         | 
| 98 | 
            +
            - app/views/forums/index.html.haml
         | 
| 99 | 
            +
            - app/views/forums/new.html.haml
         | 
| 100 | 
            +
            - app/views/forums/show.html.haml
         | 
| 72 101 | 
             
            - app/views/galleries/_form.html.haml
         | 
| 73 102 | 
             
            - app/views/galleries/_show.html.haml
         | 
| 74 103 | 
             
            - app/views/galleries/edit.html.haml
         |