saucy 0.1.1 → 0.1.2
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/README +10 -0
- data/app/views/projects/edit.html.erb +1 -1
- data/lib/generators/saucy/install/install_generator.rb +4 -0
- data/lib/generators/saucy/install/templates/controllers/projects_controller.rb +3 -0
- data/lib/saucy.rb +1 -0
- data/lib/saucy/projects_controller.rb +64 -0
- metadata +6 -5
- data/app/controllers/projects_controller.rb +0 -56
    
        data/README
    CHANGED
    
    | @@ -7,3 +7,13 @@ your config/application.rb: | |
| 7 7 |  | 
| 8 8 | 
             
              config.saucy.layouts.accounts.index = "custom"
         | 
| 9 9 |  | 
| 10 | 
            +
            To extend the ProjectsController:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              class ProjectsController < ApplicationController
         | 
| 13 | 
            +
                include Saucy::ProjectsController
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def edit
         | 
| 16 | 
            +
                  super
         | 
| 17 | 
            +
                  @deleters = @project.deleters
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
              end
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            <h2>Edit project: <%= | 
| 1 | 
            +
            <h2>Edit project: <%= @project.name %></h2>
         | 
| 2 2 | 
             
            <div class="actions">
         | 
| 3 3 | 
             
              <%= link_to project_path(@project), :method  => 'delete', :confirm => 'Are you sure you want to delete this project and all associated content?' do %>
         | 
| 4 4 | 
             
                <span class="delete_item">Remove this project</span>
         | 
    
        data/lib/saucy.rb
    CHANGED
    
    
| @@ -0,0 +1,64 @@ | |
| 1 | 
            +
            module Saucy
         | 
| 2 | 
            +
              module ProjectsController
         | 
| 3 | 
            +
                extend ActiveSupport::Concern
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                included do
         | 
| 6 | 
            +
                  before_filter :authorize_admin
         | 
| 7 | 
            +
                  layout Saucy::Layouts.to_proc
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                module InstanceMethods
         | 
| 11 | 
            +
                  def new
         | 
| 12 | 
            +
                    @project = current_account.projects.build
         | 
| 13 | 
            +
                    render
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  def create
         | 
| 17 | 
            +
                    @project = current_account.projects.build(params[:project])
         | 
| 18 | 
            +
                    if @project.save
         | 
| 19 | 
            +
                      flash[:notice] = "Project successfully created"
         | 
| 20 | 
            +
                      redirect_to edit_project_url(@project)
         | 
| 21 | 
            +
                    else
         | 
| 22 | 
            +
                      render :action => :new
         | 
| 23 | 
            +
                    end
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  def edit
         | 
| 27 | 
            +
                    @project = ::Project.find(params[:id])
         | 
| 28 | 
            +
                    render
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  def update
         | 
| 32 | 
            +
                    @project = ::Project.find(params[:id])
         | 
| 33 | 
            +
                    if @project.update_attributes params[:project]
         | 
| 34 | 
            +
                      flash[:success] = 'Project was updated.'
         | 
| 35 | 
            +
                      redirect_to account_projects_url(current_account)
         | 
| 36 | 
            +
                    else
         | 
| 37 | 
            +
                      render :action => :edit
         | 
| 38 | 
            +
                    end
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  def destroy
         | 
| 42 | 
            +
                    @project = ::Project.find(params[:id])
         | 
| 43 | 
            +
                    @project.destroy
         | 
| 44 | 
            +
                    flash[:success] = "Project has been deleted"
         | 
| 45 | 
            +
                    redirect_to account_projects_url(@project.account)
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                  def index
         | 
| 49 | 
            +
                    @projects = current_account.projects
         | 
| 50 | 
            +
                    render
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  private
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                  def current_account
         | 
| 56 | 
            +
                    if params[:id]
         | 
| 57 | 
            +
                      ::Project.find(params[:id]).account
         | 
| 58 | 
            +
                    else
         | 
| 59 | 
            +
                      super
         | 
| 60 | 
            +
                    end
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: saucy
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 31
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 1
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.1. | 
| 9 | 
            +
              - 2
         | 
| 10 | 
            +
              version: 0.1.2
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - thoughtbot, inc.
         | 
| @@ -17,7 +17,7 @@ autorequire: | |
| 17 17 | 
             
            bindir: bin
         | 
| 18 18 | 
             
            cert_chain: []
         | 
| 19 19 |  | 
| 20 | 
            -
            date: 2010-12- | 
| 20 | 
            +
            date: 2010-12-09 00:00:00 -05:00
         | 
| 21 21 | 
             
            default_executable: 
         | 
| 22 22 | 
             
            dependencies: 
         | 
| 23 23 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -103,7 +103,6 @@ files: | |
| 103 103 | 
             
            - app/controllers/accounts_controller.rb
         | 
| 104 104 | 
             
            - app/controllers/memberships_controller.rb
         | 
| 105 105 | 
             
            - app/controllers/plans_controller.rb
         | 
| 106 | 
            -
            - app/controllers/projects_controller.rb
         | 
| 107 106 | 
             
            - app/controllers/invitations_controller.rb
         | 
| 108 107 | 
             
            - app/controllers/permissions_controller.rb
         | 
| 109 108 | 
             
            - app/models/project_membership.rb
         | 
| @@ -114,6 +113,7 @@ files: | |
| 114 113 | 
             
            - lib/generators/saucy/base.rb
         | 
| 115 114 | 
             
            - lib/generators/saucy/install/install_generator.rb
         | 
| 116 115 | 
             
            - lib/generators/saucy/install/templates/create_saucy_tables.rb
         | 
| 116 | 
            +
            - lib/generators/saucy/install/templates/controllers/projects_controller.rb
         | 
| 117 117 | 
             
            - lib/generators/saucy/install/templates/models/project.rb
         | 
| 118 118 | 
             
            - lib/generators/saucy/install/templates/models/plan.rb
         | 
| 119 119 | 
             
            - lib/generators/saucy/install/templates/models/account.rb
         | 
| @@ -135,6 +135,7 @@ files: | |
| 135 135 | 
             
            - lib/saucy/plan.rb
         | 
| 136 136 | 
             
            - lib/saucy/account.rb
         | 
| 137 137 | 
             
            - lib/saucy/user.rb
         | 
| 138 | 
            +
            - lib/saucy/projects_controller.rb
         | 
| 138 139 | 
             
            - features/run_features.feature
         | 
| 139 140 | 
             
            - features/support/file.rb
         | 
| 140 141 | 
             
            - features/support/env.rb
         | 
| @@ -1,56 +0,0 @@ | |
| 1 | 
            -
            class ProjectsController < ApplicationController
         | 
| 2 | 
            -
              before_filter :authorize_admin
         | 
| 3 | 
            -
              layout Saucy::Layouts.to_proc
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              def new
         | 
| 6 | 
            -
                @project = current_account.projects.build
         | 
| 7 | 
            -
                render
         | 
| 8 | 
            -
              end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              def create
         | 
| 11 | 
            -
                @project = current_account.projects.build(params[:project])
         | 
| 12 | 
            -
                if @project.save
         | 
| 13 | 
            -
                  flash[:notice] = "Project successfully created"
         | 
| 14 | 
            -
                  redirect_to edit_project_url(@project)
         | 
| 15 | 
            -
                else
         | 
| 16 | 
            -
                  render :action => :new
         | 
| 17 | 
            -
                end
         | 
| 18 | 
            -
              end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
              def edit
         | 
| 21 | 
            -
                @project = Project.find(params[:id])
         | 
| 22 | 
            -
                render
         | 
| 23 | 
            -
              end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
              def update
         | 
| 26 | 
            -
                @project = Project.find(params[:id])
         | 
| 27 | 
            -
                if @project.update_attributes params[:project]
         | 
| 28 | 
            -
                  flash[:success] = 'Project was updated.'
         | 
| 29 | 
            -
                  redirect_to account_projects_url(current_account)
         | 
| 30 | 
            -
                else
         | 
| 31 | 
            -
                  render :action => :edit
         | 
| 32 | 
            -
                end
         | 
| 33 | 
            -
              end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
              def destroy
         | 
| 36 | 
            -
                @project = Project.find(params[:id])
         | 
| 37 | 
            -
                @project.destroy
         | 
| 38 | 
            -
                flash[:success] = "Project has been deleted"
         | 
| 39 | 
            -
                redirect_to account_projects_url(@project.account)
         | 
| 40 | 
            -
              end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
              def index
         | 
| 43 | 
            -
                @projects = current_account.projects
         | 
| 44 | 
            -
                render
         | 
| 45 | 
            -
              end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
              private
         | 
| 48 | 
            -
             | 
| 49 | 
            -
              def current_account
         | 
| 50 | 
            -
                if params[:id]
         | 
| 51 | 
            -
                  Project.find(params[:id]).account
         | 
| 52 | 
            -
                else
         | 
| 53 | 
            -
                  super
         | 
| 54 | 
            -
                end
         | 
| 55 | 
            -
              end
         | 
| 56 | 
            -
            end
         |