Skip to content

Commit

Permalink
[copycopter#11] Removing create project button and form and replacing…
Browse files Browse the repository at this point in the history
… with rake task
  • Loading branch information
Kareem committed Mar 16, 2012
1 parent e6cb39a commit b66b162
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 154 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Setup
bundle
bundle exec rake setup

Creating a Project
------------------

rake copycopter:create_project NAME=Crowdtap USERNAME=Constantine PASSWORD=Mavromoustakos

Development
-----------

Expand Down
35 changes: 1 addition & 34 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
class ProjectsController < ApplicationController
before_filter :authorize, :only => [:destroy, :edit, :show, :update]

def create
@project = Project.new(params[:project])

if @project.save
redirect_to @project
else
render :action => :new
end
end

def destroy
project = Project.find(params[:id])
project.destroy
redirect_to projects_url
end

def edit
@project = Project.find(params[:id])
end
before_filter :authorize, :only => [:show]

def index
@projects = Project.active
end

def new
@project = Project.new
end

def show
@project = Project.find(params[:id])
@locale = @project.locale(params[:locale_id])
Expand All @@ -38,13 +14,4 @@ def show
end
end

def update
@project = Project.find(params[:id])

if @project.update_attributes params[:project]
redirect_to @project
else
render :action => :edit
end
end
end
32 changes: 0 additions & 32 deletions app/views/projects/edit.html.erb

This file was deleted.

6 changes: 0 additions & 6 deletions app/views/projects/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<% content_for :button do %>
<div id='new-project'>
<%= link_to 'Create a new project', new_project_path %>
</div>
<% end %>
<% content_for :header do %>
<h2><strong>Projects</strong></h2>
<% end %>
Expand Down
11 changes: 0 additions & 11 deletions app/views/projects/new.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end
end

resources :projects do
resources :projects, :only => [:index, :show] do
resources :blurbs, :only => [:destroy]
resources :locales, :only => [:new]
end
Expand Down
10 changes: 10 additions & 0 deletions lib/tasks/copycopter.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@ namespace :copycopter do
task :regenerate_project_caches => :environment do
Project.regenerate_caches
end

task :create_project => :environment do
project = Project.new(:name => ENV['NAME'], :password => ENV['PASSWORD'], :username => ENV['USERNAME'])

if project.save
puts "Project #{project.name} created!"
else
puts "There were errors creating the project: #{project.errors.full_messages}"
end
end
end
Binary file removed public/images/create_a_project.png
Binary file not shown.
40 changes: 3 additions & 37 deletions public/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ www.webaim.org/techniques/css/invisiblecontent/ & j.mp/visuallyhidden */
visibility: hidden; }

/* >> The Magnificent CLEARFIX: Updated to prevent margin-collapsing on child elements << j.mp/bestclearfix */
.clearfix:before, .subnav:before, #content:before, #content .content-header:before, #header:before, #header #new-project:before, #footer:before, li#version_content_input .wysiwyg .toolbar:before, body.landing_page_new_design section#main-description:before, body.landing_page_new_design section#tour section#setup:before, body.landing_page_new_design section#tour section#edit:before, .clearfix:after, .subnav:after, #content:after, #content .content-header:after, #header:after, #header #new-project:after, #footer:after, li#version_content_input .wysiwyg .toolbar:after, body.landing_page_new_design section#main-description:after, body.landing_page_new_design section#tour section#setup:after, body.landing_page_new_design section#tour section#edit:after {
.clearfix:before, .subnav:before, #content:before, #content .content-header:before, #header:before, #footer:before, li#version_content_input .wysiwyg .toolbar:before, body.landing_page_new_design section#main-description:before, body.landing_page_new_design section#tour section#setup:before, body.landing_page_new_design section#tour section#edit:before, .clearfix:after, .subnav:after, #content:after, #content .content-header:after, #header:after, #footer:after, li#version_content_input .wysiwyg .toolbar:after, body.landing_page_new_design section#main-description:after, body.landing_page_new_design section#tour section#setup:after, body.landing_page_new_design section#tour section#edit:after {
content: "\0020";
display: block;
height: 0;
visibility: hidden; }

.clearfix:after, .subnav:after, #content:after, #content .content-header:after, #header:after, #header #new-project:after, #footer:after, li#version_content_input .wysiwyg .toolbar:after, body.landing_page_new_design section#main-description:after, body.landing_page_new_design section#tour section#setup:after, body.landing_page_new_design section#tour section#edit:after {
.clearfix:after, .subnav:after, #content:after, #content .content-header:after, #header:after, #footer:after, li#version_content_input .wysiwyg .toolbar:after, body.landing_page_new_design section#main-description:after, body.landing_page_new_design section#tour section#setup:after, body.landing_page_new_design section#tour section#edit:after {
clear: both; }

/* Fix clearfix: blueprintcss.lighthouseapp.com/projects/15318/tickets/5-extra-margin-padding-bottom-of-page */
.clearfix, .subnav, #content, #content .content-header, #header, #header #new-project, #footer, li#version_content_input .wysiwyg .toolbar, body.landing_page_new_design section#main-description, body.landing_page_new_design section#tour section#setup, body.landing_page_new_design section#tour section#edit {
.clearfix, .subnav, #content, #content .content-header, #header, #footer, li#version_content_input .wysiwyg .toolbar, body.landing_page_new_design section#main-description, body.landing_page_new_design section#tour section#setup, body.landing_page_new_design section#tour section#edit {
zoom: 1; }

.ie7 img {
Expand Down Expand Up @@ -928,40 +928,6 @@ body.projects-new li.projects a {
height: 57px;
text-indent: -9999px;
width: 228px; }
#header #new-project {
display: block;
float: right;
list-style: none;
margin-bottom: 0;
position: absolute;
right: 0;
top: 10px;
z-index: 100; }
#header #new-project a {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 2px 6px #b6b6b6;
-moz-box-shadow: 0 2px 6px #b6b6b6;
-ms-box-shadow: 0 2px 6px #b6b6b6;
-o-box-shadow: 0 2px 6px #b6b6b6;
box-shadow: 0 2px 6px #b6b6b6;
background: #fff;
background: url("/images/create_a_project.png") center 14px no-repeat, -moz-linear-gradient(0% 100% 90deg, #d3dee2, white);
background: url("/images/create_a_project.png") center 14px no-repeat, -webkit-gradient(linear, 0% 0%, 0% 100%, from(white), to(#d3dee2));
border: 1px solid #bbbbbb;
border-top: 1px solid #d4d4d4;
border-bottom: 1px solid #959595;
display: block;
height: 50px;
margin: 0 auto;
text-indent: -5000px;
width: 240px; }
#header #new-project a:hover {
background: url("/images/create_a_project.png") center 14px no-repeat, -moz-linear-gradient(0% 100% 90deg, #d3dee2, #f4f7f9);
background: url("/images/create_a_project.png") center 14px no-repeat, -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f4f7f9), to(#d3dee2)); }

#footer {
color: #3a4c53;
Expand Down
33 changes: 0 additions & 33 deletions public/stylesheets/sass/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,4 @@
width: 228px;
}
}

#new-project {
@extend .clearfix;
display:block;
float: right;
list-style: none;
margin-bottom: 0;
position: absolute;
right: 0;
top: 10px;
z-index: 100;

a {
@include border-radius(5px);
@include box-shadow(0 2px 6px #b6b6b6);
background: #fff;
background: url('/images/create_a_project.png') center 14px no-repeat, -moz-linear-gradient(0% 100% 90deg,#d3dee2, #fff);
background: url('/images/create_a_project.png') center 14px no-repeat, -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#d3dee2));
border: 1px solid #bbbbbb;
border-top: 1px solid #d4d4d4;
border-bottom: 1px solid #959595;
display: block;
height: 50px;
margin: 0 auto;
text-indent: -5000px;
width: 240px;

&:hover {
background: url('/images/create_a_project.png') center 14px no-repeat, -moz-linear-gradient(0% 100% 90deg, #d3dee2, #f4f7f9);
background: url('/images/create_a_project.png') center 14px no-repeat, -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f4f7f9), to(#d3dee2));
}
}
}
}

0 comments on commit b66b162

Please sign in to comment.