diff --git a/plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb b/plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb index 8c8d361..ac77d00 100644 --- a/plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb +++ b/plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb @@ -3,10 +3,7 @@ class MezuroPluginReadingController < MezuroPluginMyprofileController append_view_path File.join(File.dirname(__FILE__) + '/../../views') def new - reading_group_content = profile.articles.find(params[:id]) - @reading_group_name = reading_group_content.name - @data_profile = reading_group_content.profile.identifier - @reading_group_content_id = reading_group_content.id + @reading_group_content = profile.articles.find(params[:id]) end def create @@ -21,11 +18,7 @@ class MezuroPluginReadingController < MezuroPluginMyprofileController end def edit - reading_group_content = profile.articles.find(params[:id]) - @reading_group_name = reading_group_content.name - @data_profile = reading_group_content.profile.identifier - @reading_group_content_id = reading_group_content.id - + @reading_group_content = profile.articles.find(params[:id]) @reading = Kalibro::Reading.find params[:reading_id] end diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb index 9fa12b5..2f5cf5f 100644 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb +++ b/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb @@ -3,10 +3,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController append_view_path File.join(File.dirname(__FILE__) + '/../../views') def new - project_content = profile.articles.find(params[:id]) - @project_name = project_content.name - @data_profile = project_content.profile.identifier - @project_content_id = project_content.id + @project_content = profile.articles.find(params[:id]) @repository_types = Kalibro::Repository.repository_types @@ -32,11 +29,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController end def edit - project_content = profile.articles.find(params[:id]) - @project_name = project_content.name - @data_profile = project_content.profile.identifier - @project_content_id = project_content.id - + @project_content = profile.articles.find(params[:id]) @repository_types = Kalibro::Repository.repository_types configurations = Kalibro::Configuration.all @@ -45,7 +38,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController [configuration.name,configuration.id] end - @repository = project_content.repositories.select{ |repository| repository.id.to_s == params[:repository_id] }.first + @repository = @project_content.repositories.select{ |repository| repository.id.to_s == params[:repository_id] }.first end def update @@ -63,12 +56,9 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController end def show - project_content = profile.articles.find(params[:id]) - @project_name = project_content.name - @repository = project_content.repositories.select{ |repository| repository.id.to_s == params[:repository_id] }.first + @project_content = profile.articles.find(params[:id]) + @repository = @project_content.repositories.select{ |repository| repository.id.to_s == params[:repository_id] }.first @configuration_name = Kalibro::Configuration.configuration_of(@repository.id).name - @data_profile = project_content.profile.identifier - @data_content = project_content.id end def destroy diff --git a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb b/plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb index ecc0288..280d862 100644 --- a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb +++ b/plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb @@ -22,10 +22,8 @@ class MezuroPluginReadingControllerTest < ActionController::TestCase should 'set variables to create a new reading' do get :new, :profile => @profile.identifier, :id => @content.id - - assert_equal @content.id, assigns(:reading_group_content_id) - assert_equal @content.name, assigns(:reading_group_name) - assert_equal @content.profile.identifier, assigns(:data_profile) + assert_equal @content.id, assigns(:reading_group_content).id + assert_response :success end should 'create a reading' do @@ -47,13 +45,10 @@ class MezuroPluginReadingControllerTest < ActionController::TestCase should 'set variables to edit a reading' do Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading) - get :edit, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id - - assert_equal @content.id, assigns(:reading_group_content_id) - assert_equal @content.name, assigns(:reading_group_name) - assert_equal @content.profile.identifier, assigns(:data_profile) + assert_equal @content.id, assigns(:reading_group_content).id assert_equal @reading, assigns(:reading) + assert_response :success end should 'update a reading' do diff --git a/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb b/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb index bb4e4a0..8e26a93 100644 --- a/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb +++ b/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb @@ -31,12 +31,11 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase get :new, :profile => @profile.identifier, :id => @content.id - assert_equal @content.id, assigns(:project_content_id) - assert_equal @content.name, assigns(:project_name) + assert_equal @content.id, assigns(:project_content).id assert_equal @repository_types, assigns(:repository_types) - assert_equal @content.profile.identifier, assigns(:data_profile) assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last + assert_response :success end should 'create a repository' do @@ -58,20 +57,18 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase end should 'set variables to edit a repository' do - articles = mock Kalibro::Repository.expects(:repository_types).returns(@repository_types) Kalibro::Configuration.expects(:all).returns(@all_configurations) Kalibro::Repository.expects(:repositories_of).with(@content.project_id).returns([@repository]) get :edit, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id - assert_equal @content.id, assigns(:project_content_id) - assert_equal @content.name, assigns(:project_name) + assert_equal @content.id, assigns(:project_content).id assert_equal @repository_types, assigns(:repository_types) - assert_equal @content.profile.identifier, assigns(:data_profile) assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last assert_equal @repository, assigns(:repository) + assert_response :success end should 'update a repository' do @@ -98,11 +95,9 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase get :show, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id - assert_equal @content.name, assigns(:project_name) + assert_equal @content.id, assigns(:project_content).id assert_equal @repository, assigns(:repository) assert_equal @configuration.name, assigns(:configuration_name) - assert_equal @content.profile.identifier, assigns(:data_profile) - assert_equal @content.id, assigns(:data_content) assert_response :success end diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb index 2a11812..2075e60 100644 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb @@ -1,4 +1,4 @@ -

<%= @configuration_content.name%> Configuration

+

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

<%= link_to "New Compound Metric", :controller => "mezuro_plugin_metric_configuration", :action => "new_compound", :id => @configuration_content.id %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb index c64f2b5..20c0f9e 100644 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb @@ -2,7 +2,7 @@ -

<%= @configuration_content.name %> Configuration

+

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

<% owner = (not user.nil?) && user.id == @profile.id %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb index 176e45d..44230e8 100644 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb @@ -2,7 +2,7 @@ -

<%= @configuration_content.name %> Configuration

+

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

<% owner = (not user.nil?) && user.id == @profile.id %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb index bbf0b2b..fd4b5fa 100644 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb @@ -1,4 +1,4 @@ -

<%= @configuration_content.name %> Configuration

+

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

<% form_for :metric_configuration, :url => {:action =>"create_compound", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> <%= hidden_field_tag :id, @configuration_content.id %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb index dce726d..0943197 100644 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb @@ -1,6 +1,6 @@ -

<%= @configuration_content.name %> Configuration

+

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

<% form_for :metric_configuration, :url => {:action =>"create_native", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> diff --git a/plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb b/plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb index 8c9b930..71ad4fb 100644 --- a/plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb @@ -1,9 +1,9 @@ -

<%= link_to( @reading_group_name, homepage_url(@data_profile, @reading_group_name.downcase.gsub(/[^0-9A-Za-z\-]/, '-')) ) %>

+

<%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %>

<% form_for :reading, :url => {:action =>"update", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @reading_group_content_id %> + <%= hidden_field_tag :id, @reading_group_content.id %> <%= f.hidden_field :id %> <%= required labelled_form_field _('label:'), f.text_field(:label) %> diff --git a/plugins/mezuro/views/mezuro_plugin_reading/new.html.erb b/plugins/mezuro/views/mezuro_plugin_reading/new.html.erb index b197d7e..5aaa73a 100644 --- a/plugins/mezuro/views/mezuro_plugin_reading/new.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_reading/new.html.erb @@ -1,9 +1,9 @@ -

<%= link_to( @reading_group_name, homepage_url(@data_profile, @reading_group_name.downcase.gsub(/[^0-9A-Za-z\-]/, '-')) ) %>

+

<%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %>

<% form_for :reading, :url => {:action =>"create", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @reading_group_content_id %> + <%= hidden_field_tag :id, @reading_group_content.id %> <%= required labelled_form_field _('label:'), f.text_field(:label) %> diff --git a/plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb index 78d8831..e3c2e1f 100644 --- a/plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb @@ -1,17 +1,12 @@ -

<%= link_to( @project_name, homepage_url(@data_profile, @project_name.downcase.gsub(/[^0-9A-Za-z]/, '')) ) %>

+

<%= link_to("#{@project_content.name} Project", @project_content.view_url) %>

<% form_for :repository, :url => {:action =>"update", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @project_content_id %> + <%= hidden_field_tag :id, @project_content.id %> <%= f.hidden_field :id%> <%= required labelled_form_field _('Name:'), f.text_field(:name) %> -
- <%= f.label :description, "Description:", :class => 'formlabel' %> -
- <%= f.text_field :description %> -
-
+ <%= labelled_form_field _("Description:"), f.text_field(:description) %> <%= required labelled_form_field _('License'), f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.license_options, :selected => @repository.license) %> @@ -28,8 +23,6 @@ <%= required labelled_form_field _('Configuration'), f.select(:configuration_id, @configuration_select, :selected => @repository.configuration_id.to_i) %> -

- <%= f.submit "Add" %> -

+

<%= f.submit "Add" %>

<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_repository/new.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/new.html.erb index 35217e8..df9f65b 100644 --- a/plugins/mezuro/views/mezuro_plugin_repository/new.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_repository/new.html.erb @@ -1,16 +1,11 @@ -

<%= link_to( @project_name, homepage_url(@data_profile, @project_name.downcase.gsub(/[^0-9A-Za-z]/, '')) ) %>

+

<%= link_to("#{@project_content.name} Project", @project_content.view_url) %>

<% form_for :repository, :url => {:action =>"create", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @project_content_id %> + <%= hidden_field_tag :id, @project_content.id %> <%= required labelled_form_field _('Name:'), f.text_field(:name) %> -
- <%= f.label :description, "Description:", :class => 'formlabel' %> -
- <%= f.text_field :description %> -
-
+ <%= labelled_form_field _('Description'), f.text_field(:description) %> <%= required labelled_form_field _('License'), f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.license_options) %> @@ -27,8 +22,6 @@ <%= required labelled_form_field _('Configuration'), f.select(:configuration_id, @configuration_select) %> -

- <%= f.submit "Add" %> -

+

<%= f.submit "Add" %>

<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_repository/show.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/show.html.erb index d9cb60a..8d8a72c 100644 --- a/plugins/mezuro/views/mezuro_plugin_repository/show.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_repository/show.html.erb @@ -1,5 +1,5 @@ -

<%= link_to( @project_name, homepage_url(@data_profile, @project_name.downcase.gsub(/[^0-9A-Za-z]/, '')) ) %>

+

<%= link_to("#{@project_content.name} Project", @project_content.view_url) %>

@@ -40,6 +40,6 @@

-
-- libgit2 0.21.2