Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test request #5

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
nbproject/

5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
group :test do
gem 'rspec'
gem 'rspec-rails'
gem 'jeweler'
end
14 changes: 11 additions & 3 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A copy of the released version can be downloaded from {Little Stream Software}[h

== Install

1. Follow the Redmine plugin installation steps at: http://www.redmine.org/wiki/redmine/Plugins Make sure the plugin is installed to +vendor/plugins/customer_plugin+
1. Follow the Redmine plugin installation steps at: http://www.redmine.org/wiki/redmine/Plugins Make sure the plugin is installed to +plugins/customer_plugin+
2. Setup the database using the migrations. +rake db:migrate_plugins+
3. Login to your Redmine install as an Administrator
4. Setup the permissions for your roles
Expand All @@ -33,12 +33,12 @@ A copy of the released version can be downloaded from {Little Stream Software}[h
=== Zip file

1. Download the latest zip file from https://projects.littlestreamsoftware.com
2. Unzip the file to your Redmine into vendor/plugins
2. Unzip the file to your Redmine into plugins/
3. Restart your Redmine

=== Git

1. Open a shell to your Redmine's vendor/plugins/customer_plugin folder
1. Open a shell to your Redmine's plugins/customer_plugin folder
2. Update your git copy with +git pull+
3. Restart your Redmine

Expand All @@ -50,3 +50,11 @@ This plugin is licensed under the GNU GPL v2. See LICENSE.txt and GPL.txt for d

If you need help you can contact the maintainer at the Bug Tracker. The bug tracker is located at: https://projects.littlestreamsoftware.com

== Running tests

1. Go to your redmine root directory
2. Install the needed gems: bundle install
3. Prepare the database: RAILS_ENV=test rake db:create db:migrate redmine:plugins db:schema:dump db:fixtures:load
4. Run the tests with: rspec plugins/customer_plugin/spec

NB: running the task directly from the plugin folder doesn't work really well with bundler, so it's not recommended.
42 changes: 20 additions & 22 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env ruby
require "fileutils"
require 'rubygems'
gem 'rspec'
gem 'rspec-rails'

Dir[File.expand_path(File.dirname(__FILE__)) + "/lib/tasks/**/*.rake"].sort.each { |ext| load ext }

Expand All @@ -16,8 +13,8 @@ REDMINE_LIB = File.expand_path(REDMINE_ROOT + '/lib')

require 'rake'
require 'rake/clean'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'rdoc/task'
require 'rspec/core/rake_task'

PROJECT_NAME = 'customer_plugin'
ZIP_FILE = PROJECT_NAME + ".zip"
Expand All @@ -32,37 +29,38 @@ task :default => :spec
task :stats => "spec:statsetup"

desc "Run all specs in spec directory (excluding plugin specs)"
Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
t.spec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb']
RSpec::Core::RakeTask.new(:spec => spec_prereq) do |t|
t.rspec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
t.pattern = 'spec/**/*_spec.rb'
end

namespace :spec do
desc "Run all specs in spec directory with RCov (excluding plugin specs)"
Spec::Rake::SpecTask.new(:rcov) do |t|
t.spec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb']
RSpec::Core::RakeTask.new(:rcov) do |t|
t.rspec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
t.pattern = 'spec/**/*_spec.rb'
t.rcov = true
t.rcov_opts ||= []
t.rcov_opts << ["--rails", "--sort=coverage", "--exclude '/var/lib/gems,spec,#{REDMINE_APP},#{REDMINE_LIB}'"]
end

desc "Print Specdoc for all specs (excluding plugin specs)"
Spec::Rake::SpecTask.new(:doc) do |t|
t.spec_opts = ["--format", "specdoc", "--dry-run"]
t.spec_files = FileList['spec/**/*_spec.rb']
desc "Print RSpecdoc for all specs (excluding plugin specs)"
RSpec::Core::RakeTask.new(:doc) do |t|
t.rspec_opts = ["--format", "specdoc", "--dry-run"]
t.pattern = 'spec/**/*_spec.rb'
end

desc "Print Specdoc for all specs as HTML (excluding plugin specs)"
Spec::Rake::SpecTask.new(:htmldoc) do |t|
t.spec_opts = ["--format", "html:doc/rspec_report.html", "--loadby", "mtime"]
t.spec_files = FileList['spec/**/*_spec.rb']
desc "Print RSpecdoc for all specs as HTML (excluding plugin specs)"
RSpec::Core::RakeTask.new(:htmldoc) do |t|
t.rspec_opts = ["--format", "html:doc/rspec_report.html", "--loadby", "mtime"]
t.pattern = 'spec/**/*_spec.rb'
end

[:models, :controllers, :views, :helpers, :lib].each do |sub|
desc "Run the specs under spec/#{sub}"
Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
t.spec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
RSpec::Core::RakeTask.new(sub => spec_prereq) do |t|
t.rspec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
t.pattern = "spec/#{sub}/**/*_spec.rb"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.3.0
1 change: 1 addition & 0 deletions app/controllers/customers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def edit

def update
#@customer = Customer.find_by_id(params[:customer_id])
Rails.logger.debug @customer.inspect
if @customer.update_attributes(params[:customer])
flash[:notice] = l(:notice_successful_update)
redirect_to :action => "list", :id => params[:id]
Expand Down
16 changes: 8 additions & 8 deletions app/views/customers/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<%= error_messages_for 'customer' %>

<div class="box">
<div class="box tabular">
<p>
<%= f.text_field 'name', :label=>l(:field_customer_name) -%>
<%= f.text_field :name, :label=>l(:field_customer_name) -%>
</p>
<p>
<%= f.text_field 'company', :label=>l(:field_customer_company) -%>
<%= f.text_field :company, :label=>l(:field_customer_company) -%>
</p>
<p>
<%= f.text_area 'address', :label=>l(:field_customer_address), :rows => 5 -%>
<%= f.text_area :address, :label=>l(:field_customer_address), :rows => 5 %>
</p>
<p>
<%= f.text_field 'phone', :label=>l(:field_customer_phone) -%>
<%= f.text_field :phone, :label=>l(:field_customer_phone) %>
</p>
<p>
<%= f.text_field 'email', :label=>l(:field_customer_email) -%>
<%= f.text_field :email, :label=>l(:field_customer_email) -%>
</p>
<p>
<%= f.text_field 'website', :label=>l(:field_customer_website) -%>
<%= f.text_field :website, :label=>l(:field_customer_website) -%>
</p>
<p>
<%= f.text_field 'skype_name', :label=>l(:field_customer_skype) -%>
<%= f.text_field :skype_name, :label=>l(:field_customer_skype) -%>
</p>
</div>
6 changes: 3 additions & 3 deletions app/views/customers/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

<h2><%= l(:label_customer_edit_information) %></h2>

<% labelled_tabular_form_for :customer, @customer, :url =>{:action => 'update', :id => @project, :customer_id => @customer.id} do |f| %>
<%= labelled_form_for @customer, :url =>{:action => 'update', :id => @project, :customer_id => @customer.id} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_save) -%>
<% end -%>

<% content_for(:header_tags) do %>
<style type="text/css">
.icon-users { background-image: url(../../images/users.png); }
.icon-users { background-image: url(../../../images/group.png); }
</style>
<% end %>
<% end %>
32 changes: 20 additions & 12 deletions app/views/customers/list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,33 @@

<% unless @customers.empty? %>
<table class="list">
<% @customers.each do |customer| %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%= customer.pretty_name %></td>
<td align="right">
<small>
<%= link_to_if_authorized l(:button_edit), {:controller => 'customers', :action => 'edit', :id => @project, :customer_id => customer.id}, :class => 'icon icon-edit' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'customers', :action => 'destroy', :id => @project, :customer_id => customer.id}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
</small>
</td>
</tr>
<% end %>
<thead>
<tr>
<th class="left"><%= l(:customer_title) %></th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<% @customers.each do |customer| %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%= customer.pretty_name %></td>
<td align="right">
<small>
<%= link_to_if_authorized l(:button_edit), {:controller => 'customers', :action => 'edit', :id => @project, :customer_id => customer.id}, :class => 'icon icon-edit' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'customers', :action => 'destroy', :id => @project, :customer_id => customer.id}, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
</small>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p class="nodata"><%=l(:label_no_data)%></p>
<% end %>

<% content_for(:header_tags) do %>
<style type="text/css">
.icon-users { background-image: url(../../images/users.png); }
.icon-users { background-image: url(../../../images/group.png); }
</style>
<% end %>

6 changes: 3 additions & 3 deletions app/views/customers/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

<h2><%= l(:label_customer_new) %></h2>

<% labelled_tabular_form_for :customer, @customer, :url =>{:action => 'create', :id => @project} do |f| %>
<%= labelled_form_for @customer, :url =>{:action => 'create', :id => @project} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_save) -%>
<% end -%>

<% content_for(:header_tags) do %>
<style type="text/css">
.icon-users { background-image: url(../../images/users.png); }
.icon-users { background-image: url(../../../images/group.png); }
</style>
<% end %>
<% end %>
4 changes: 2 additions & 2 deletions app/views/customers/select.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<h2><%= l(:label_customer_assign) %></h2>

<% form_for :customer, :url =>{:action => 'assign', :id => @project} do |f| %>
<%= form_for :customer, :url =>{:action => 'assign', :id => @project} do |f| %>
<div class="box">
<p>
<label for="customer"><%= l(:label_customer) %></label>
Expand All @@ -22,6 +22,6 @@

<% content_for(:header_tags) do %>
<style type="text/css">
.icon-users { background-image: url(../../images/users.png); }
.icon-users { background-image: url(../../../images/group.png); }
</style>
<% end %>
4 changes: 2 additions & 2 deletions app/views/customers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

<% content_for(:header_tags) do %>
<style type="text/css">
.icon-users { background-image: url(../../images/users.png); }
.icon-users { background-image: url(../../../images/group.png); }
</style>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
en:
customer_title: Customer
customer_title: "Customer"
label_customer: Customer
label_customer_plural: Customer List
label_customer_information: Customer Information
Expand Down
12 changes: 12 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RedmineApp::Application.routes.draw do
# match '/projects/:project_id/customers/:action', :controller => 'customers'
get '/projects/:id/customers', :to => 'customers#show'
get '/projects/:id/customers/edit', :to => 'customers#edit'
get '/projects/:id/customers/select', :to => 'customers#select'
get '/projects/:id/customers/list', :to => 'customers#list'
get '/projects/:id/customers/new', :to => 'customers#new'
post '/projects/:id/customers/assign', :to => 'customers#assign'
put '/projects/:id/customers', :controller => 'customers', :action => 'update'
post '/projects/:id/customers', :controller => 'customers', :action => 'create'
delete '/projects/:id/customers', :controller => 'customers', :action => 'destroy'
end
19 changes: 0 additions & 19 deletions lang/ca.yml

This file was deleted.

19 changes: 0 additions & 19 deletions lang/de.yml

This file was deleted.

19 changes: 0 additions & 19 deletions lang/en.yml

This file was deleted.

19 changes: 0 additions & 19 deletions lang/es.yml

This file was deleted.

19 changes: 0 additions & 19 deletions lang/fr.yml

This file was deleted.

Loading