voluntary 0.6.0 → 0.7.0

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.
@@ -27,7 +27,7 @@ class StoriesController < ApplicationController
27
27
 
28
28
  def create
29
29
  if @story.initialization
30
- redirect_to edit_story_path(@story) and return
30
+ redirect_to @story.after_creation_path and return
31
31
  else
32
32
  render_wizard
33
33
  end
@@ -1,68 +1,65 @@
1
1
  class TasksController < ApplicationController
2
2
  include Applicat::Mvc::Controller::Resource
3
- include Wizard::Controller
4
-
5
- wizard_steps :setup_tasks, :activate
6
3
 
7
4
  before_filter :build_resource, only: [:new, :create]
8
- before_filter :resource, only: [:show, :edit, :update, :setup_tasks, :activate]
5
+ before_filter :resource, only: [:show, :edit, :update, :destroy]
9
6
 
10
7
  load_and_authorize_resource
11
8
 
12
9
  respond_to :html, :js, :json
13
10
 
14
11
  def index
15
- parent = find_parent Task::PARENT_TYPES
16
- @tasks = parent ? parent.tasks : Task.all
12
+ @story = Story.find(params[:story_id])
13
+ @project = @story.project
14
+ @tasks = @story.custom_tasks
15
+ @tasks = @tasks.paginate(page: params[:page], per_page: 25)
16
+ @twitter_sidenav_level = 5
17
17
  end
18
18
 
19
19
  def show
20
20
  @comments = @task.comments
21
+ @hide_sidebar = true
22
+
23
+ begin
24
+ raise NotImplementedError if @project.product_id.blank?
25
+
26
+ render "products/types/#{@project.product.class.name.split('Product::').last.tableize.singularize}/tasks/show"
27
+ rescue NotImplementedError, ActionView::MissingTemplate
28
+ render 'show'
29
+ end
21
30
  end
22
31
 
23
32
  def new
24
- render_wizard
25
33
  end
26
34
 
27
35
  def create
28
- if @task.initialization
29
- redirect_to edit_task_path(@task) and return
36
+ if @task.save
37
+ redirect_to story_tasks_path(@story), notice: t('tasks.create.successful')
30
38
  else
31
- render_wizard
39
+ render 'new'
32
40
  end
33
41
  end
34
42
 
35
43
  def edit
36
- render_wizard
37
44
  end
38
45
 
39
46
  def update
40
- @task.attributes = params[:task]
41
-
42
- # shift the first empty task set after initialization on state :initialized
43
- @task.tasks.shift if params[:next_step] == '1' && !@task.tasks.first.valid?
44
- success = params[:next_step] == '1' ? @task.send(step) : @task.save
45
-
46
- if success
47
+ if @task.update(params[:task])
47
48
  redirect_to(
48
- edit_task_path(@task), notice: t('general.form.successfully_updated')
49
+ edit_task_path(@task), notice: t('tasks.update.successful')
49
50
  )
50
- else
51
- render_wizard
52
51
  end
53
-
54
- return
55
52
  end
56
53
 
57
54
  def destroy
58
- @task = Task.find(params[:id])
59
55
  @task.destroy
60
- redirect_to @task.story, notice: t('general.form.destroyed')
56
+ redirect_to story_tasks_path(@story), notice: t('general.form.destroyed')
61
57
  end
62
58
 
63
59
  def resource
64
60
  @task = Task.find(params[:id]) unless @task || !params[:id].present?
65
61
  @story = @task.story unless @story || !@task
62
+ @project = @story.project
66
63
  @task
67
64
  end
68
65
 
@@ -76,13 +73,7 @@ class TasksController < ApplicationController
76
73
 
77
74
  def build_resource
78
75
  @story = find_parent Task::PARENT_TYPES, action_name == 'create' ? :task : nil
76
+ @project = @story.project
79
77
  @task = @story.tasks.new({ story_id: @story.id }.merge(params[:task] || {}))
80
78
  end
81
-
82
- def render_wizard
83
- @presenter = Resources::General::Wizards::TaskPresenter.new(
84
- self.view_context, resource: resource
85
- )
86
- render 'general/wizard'
87
- end
88
79
  end
@@ -18,24 +18,31 @@ class UsersController < ApplicationController
18
18
  end
19
19
 
20
20
  def edit
21
+ @user.attributes = params[:user] if params[:user].present?
21
22
  end
22
23
 
23
24
  def preferences
24
- if params[:user] && current_user.update_attributes(params[:user])
25
- redirect_to preferences_user_path(current_user), notice: t('general.form.successfully_updated') and return
25
+ raise CanCan::AccessDenied if !current_user || (current_user.id != @user.id && !current_user.roles?(:master))
26
+
27
+ if params[:user] && @user.update_attributes(params[:user])
28
+ redirect_to preferences_user_path(@user), notice: t('general.form.successfully_updated') and return
26
29
  end
27
30
  end
28
31
 
29
32
  def update
30
- if current_user.update_attributes(params[:user])
31
- redirect_to edit_user_path(current_user), notice: t('general.form.successfully_updated')
33
+ raise CanCan::AccessDenied if !current_user || (current_user.id != @user.id && !current_user.roles?(:master))
34
+
35
+ if @user.update_attributes(params[:user])
36
+ redirect_to edit_user_path(@user), notice: t('general.form.successfully_updated')
32
37
  else
33
38
  render :edit
34
39
  end
35
40
  end
36
41
 
37
42
  def destroy
38
- current_user.destroy
43
+ raise CanCan::AccessDenied if !current_user || (current_user.id != @user.id && !current_user.roles?(:master))
44
+
45
+ @user.destroy
39
46
  redirect_to users_url, notice: t('general.form.destroyed')
40
47
  end
41
48
 
@@ -1,4 +1,6 @@
1
1
  class Workflow::ProductsController < ApplicationController
2
+ before_action :authenticate_user!
3
+
2
4
  def show
3
5
  @stories = Product.stories(params[:id], current_user)
4
6
  @areas = Area.find_by_product_id(params[:id])
data/app/models/story.rb CHANGED
@@ -77,6 +77,14 @@ class Story
77
77
  task
78
78
  end
79
79
 
80
+ def after_creation_path
81
+ Rails.application.routes.url_helpers.edit_story_path self
82
+ end
83
+
84
+ def custom_tasks
85
+ tasks
86
+ end
87
+
80
88
  protected
81
89
 
82
90
  def with_offeror
data/app/models/user.rb CHANGED
@@ -28,7 +28,7 @@ class User < ActiveRecord::Base
28
28
  attr_accessible :name, :password, :password_confirmation, :remember_me, :text, :language, :first_name, :last_name,
29
29
  :salutation, :marital_status, :family_status, :date_of_birth, :place_of_birth, :citizenship,
30
30
  :email, :country, :language, :interface_language, :foreign_language_tokens, :profession_id,
31
- :employment_relationship, :area_tokens, :remember_me
31
+ :employment_relationship, :area_tokens, :remember_me, :timezone
32
32
 
33
33
  # :timeoutable, :token_authenticatable, :lockable,
34
34
  # :lock_strategy => :none, :unlock_strategy => :nones
@@ -7,7 +7,7 @@ class Resources::User::FormPresenter < ResourcePresenter
7
7
  list += [:password, :password_confirmation] if resource.new_record? && resource.provider.blank?
8
8
 
9
9
  list += [
10
- :country, :language, :interface_language, :foreign_language_tokens, :profession,
10
+ :country, :language, :interface_language, :foreign_language_tokens, :timezone, :profession,
11
11
  :employment_relationship, :area_tokens
12
12
  ]
13
13
 
@@ -6,10 +6,11 @@
6
6
  <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
8
  <%= stylesheet_link_tag *voluntary_application_stylesheets, media: 'all' %>
9
+ <%= yield :stylesheet_includes %>
9
10
  <link href="//netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css" rel="stylesheet"/>
10
11
  </head>
11
12
  <body>
12
- <div id="bootstrap_modal" class="modal fade"></div>
13
+ <div id="bootstrap_modal" class="modal fade" style="overflow-y:auto;"></div>
13
14
 
14
15
  <section id="dialog">
15
16
  <img alt="Ajax-loader-small" class="hide " id="dialog_body_spinner" src="<%=image_path('voluntary/spinner.gif')%>"/>
@@ -0,0 +1,5 @@
1
+ <%= simple_form_for(@task, url: @task.new_record? ? tasks_path : task_path(@task), as: :task, html: {class: 'form-vertical', style: 'margin-bottom:15px;'}) do |f| %>
2
+ <%= f.input :name %>
3
+ <%= f.input :text, as: :text %>
4
+ <%= f.button :submit %>
5
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1><%= t('tasks.edit.title') %></h1>
2
+
3
+ <%= render_product_specific_partial_if_available @story, 'tasks/form' %>
@@ -0,0 +1,5 @@
1
+ <h1><%= t('tasks.index.title') %></h1>
2
+
3
+ <%= render_product_specific_partial_if_available(@story, 'tasks/collection', collection: @tasks) %>
4
+
5
+ <%= will_paginate @tasks %>
@@ -0,0 +1,3 @@
1
+ <h1><%= t('tasks.new.title') %></h1>
2
+
3
+ <%= render_product_specific_partial_if_available @story, 'tasks/form' %>
@@ -7,14 +7,14 @@
7
7
 
8
8
  <h4><%= t('tasks.show.story_text') %></h4>
9
9
 
10
- <%= resource.story.text %>
10
+ <%= markdown resource.story.text %>
11
11
 
12
12
  <% if resource.text.present? %>
13
- <h4><%= t('tasks.show.text') %></h4>
14
-
15
- <%= resource.text %>
13
+ <h4><%= t('tasks.show.text') %></h4>
14
+
15
+ <%= markdown resource.text %>
16
16
  <% end %>
17
17
 
18
18
  <h4><%= t('activerecord.models.result') %></h4>
19
19
 
20
- <%= resource.result.text if resource.result_id.present? %>
20
+ <%= markdown resource.result.text if resource.result_id.present? %>
@@ -17,6 +17,8 @@
17
17
  f.input attribute, collection: available_language_options
18
18
  when :foreign_language_tokens
19
19
  f.input attribute, as: :string, input_html: { data: { load: resource.foreign_language_tokens } } unless Rails.env == 'test'
20
+ when :timezone
21
+ f.input attribute, as: :time_zone
20
22
  when :profession
21
23
  autocomplete_input(f, attribute)
22
24
  when :employment_relationship
@@ -4,12 +4,16 @@ en:
4
4
  anonymous: Anonymous
5
5
  authentication: Authentication
6
6
  author: Author
7
+ calendar: Calendar
7
8
  cancel: Cancel
8
9
  contra: contra
9
10
  issues: Issues
11
+ list: List
10
12
  neutral: neutral
11
13
  pro: pro
12
14
  sign_out: Sign out
15
+ sign_up: Sign up
16
+ unlimited: unlimited
13
17
  vote: Vote
14
18
 
15
19
  index:
@@ -62,9 +66,11 @@ en:
62
66
  license: Code licensed under %{link}
63
67
 
64
68
  attributes:
65
- id: ID
69
+ id: ID
70
+ from: From
66
71
  name: Name
67
72
  text: Text
73
+ to: To
68
74
  parent: Parent
69
75
  project_id: Project
70
76
  state: State
@@ -73,6 +79,11 @@ en:
73
79
  position: Position
74
80
  date: Date
75
81
  trend: Trend
82
+ address: Address
83
+ description: Description
84
+ string: String
85
+ timezone: Timezone
86
+ resource_type: Resource type
76
87
 
77
88
  activerecord:
78
89
  models:
@@ -17,6 +17,9 @@ en:
17
17
  new:
18
18
  title: New Task
19
19
 
20
+ create:
21
+ successful: Task successfully created.
22
+
20
23
  show:
21
24
  story_text: Story
22
25
  text: Task Text
@@ -25,6 +28,9 @@ en:
25
28
 
26
29
  edit:
27
30
  title: Edit Task
31
+
32
+ update:
33
+ successful: Task successfully updated.
28
34
 
29
35
  activerecord:
30
36
  errors:
@@ -1,5 +1,5 @@
1
1
  class AddApiKeyToUsers < ActiveRecord::Migration
2
- def change
2
+ def up
3
3
  add_column :users, :api_key, :string, limit: 32
4
4
 
5
5
  User.where('api_key IS NULL').find_each do |user|
@@ -10,4 +10,8 @@ class AddApiKeyToUsers < ActiveRecord::Migration
10
10
  user.save!
11
11
  end
12
12
  end
13
+
14
+ def down
15
+ remove_column :users, :api_key
16
+ end
13
17
  end
@@ -0,0 +1,5 @@
1
+ class AddTimezoneToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :timezone, :string
4
+ end
5
+ end
@@ -21,12 +21,10 @@ module Vendors
21
21
  options.merge!(method: item.method, confirm: I18n.t('general.questions.are_you_sure'))
22
22
  end
23
23
 
24
- content += content_tag :li, link_to(item.name, item.url, options), class: klass
24
+ content += link_to(item.name, item.url, options.merge({ class: "list-group-item #{klass}"}))
25
25
  end
26
26
 
27
- ul = content_tag :ul, content, class: 'nav nav-list'
28
-
29
- content_tag :div, ul, class: 'well sidebar-nav'
27
+ content_tag :div, content_tag(:div, content, class: 'list-group'), class: 'well sidebar-nav'
30
28
  end
31
29
  end
32
30
  end
data/lib/voluntary.rb CHANGED
@@ -61,6 +61,8 @@ require 'csv'
61
61
  require 'httparty'
62
62
  require 'active_model/serializer'
63
63
  require 'mongoid_orderable'
64
+ require 'momentjs-rails'
65
+ require 'fullcalendar-rails'
64
66
 
65
67
  require 'voluntary/navigation'
66
68
 
@@ -1,3 +1,3 @@
1
1
  module Voluntary
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voluntary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Gawlista
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-01 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -654,6 +654,20 @@ dependencies:
654
654
  - - "~>"
655
655
  - !ruby/object:Gem::Version
656
656
  version: 2.0.2
657
+ - !ruby/object:Gem::Dependency
658
+ name: fullcalendar-rails
659
+ requirement: !ruby/object:Gem::Requirement
660
+ requirements:
661
+ - - "~>"
662
+ - !ruby/object:Gem::Version
663
+ version: '2.4'
664
+ type: :runtime
665
+ prerelease: false
666
+ version_requirements: !ruby/object:Gem::Requirement
667
+ requirements:
668
+ - - "~>"
669
+ - !ruby/object:Gem::Version
670
+ version: '2.4'
657
671
  - !ruby/object:Gem::Dependency
658
672
  name: will_paginate
659
673
  requirement: !ruby/object:Gem::Requirement
@@ -728,16 +742,16 @@ dependencies:
728
742
  name: jquery-rails
729
743
  requirement: !ruby/object:Gem::Requirement
730
744
  requirements:
731
- - - '='
745
+ - - "~>"
732
746
  - !ruby/object:Gem::Version
733
- version: 2.2.2
747
+ version: 3.1.1
734
748
  type: :runtime
735
749
  prerelease: false
736
750
  version_requirements: !ruby/object:Gem::Requirement
737
751
  requirements:
738
- - - '='
752
+ - - "~>"
739
753
  - !ruby/object:Gem::Version
740
- version: 2.2.2
754
+ version: 3.1.1
741
755
  - !ruby/object:Gem::Dependency
742
756
  name: jquery-ui-bootstrap-rails-asset
743
757
  requirement: !ruby/object:Gem::Requirement
@@ -1144,7 +1158,7 @@ dependencies:
1144
1158
  - - "~>"
1145
1159
  - !ruby/object:Gem::Version
1146
1160
  version: 2.2.0
1147
- description: "#Crowdsourcing management system for #RubyOnRails: http://bit.ly/voluntary-0-6-0"
1161
+ description: "#Crowdsourcing management system for #RubyOnRails: http://bit.ly/voluntary-0-7-0"
1148
1162
  email:
1149
1163
  - gawlista@gmail.com
1150
1164
  executables: []
@@ -1163,9 +1177,9 @@ files:
1163
1177
  - app/assets/javascripts/voluntary/lib/jquery.cookie.js
1164
1178
  - app/assets/javascripts/voluntary/lib/jquery.multisortable.js
1165
1179
  - app/assets/javascripts/voluntary/lib/jquery.toggle_text.js.coffee
1166
- - app/assets/javascripts/voluntary/lib/moment.js
1167
1180
  - app/assets/javascripts/voluntary/lib/sugar.js
1168
1181
  - app/assets/javascripts/voluntary/likes/list.js.coffee
1182
+ - app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js
1169
1183
  - app/assets/javascripts/voluntary/users.js.coffee
1170
1184
  - app/assets/javascripts/voluntary/workflow/user/index.js.coffee
1171
1185
  - app/assets/stylesheets/voluntary/application.css
@@ -1334,6 +1348,10 @@ files:
1334
1348
  - app/views/stories/steps/_setup_tasks.html.erb
1335
1349
  - app/views/stories/tasks.html.erb
1336
1350
  - app/views/tasks/_collection.html.erb
1351
+ - app/views/tasks/_form.html.erb
1352
+ - app/views/tasks/edit.html.erb
1353
+ - app/views/tasks/index.html.erb
1354
+ - app/views/tasks/new.html.erb
1337
1355
  - app/views/tasks/show.html.erb
1338
1356
  - app/views/users/_form.html.erb
1339
1357
  - app/views/users/edit.html.erb
@@ -1422,6 +1440,7 @@ files:
1422
1440
  - db/migrate/20150818151512_create_or_alter_arguments.rb
1423
1441
  - db/migrate/20150821102558_add_vote_column_to_arguments.rb
1424
1442
  - db/migrate/20150823174056_add_likes_count_to_arguments.rb
1443
+ - db/migrate/20151022163015_add_timezone_to_users.rb
1425
1444
  - lib/api_constraints.rb
1426
1445
  - lib/applicat/mvc/controller.rb
1427
1446
  - lib/applicat/mvc/controller/error_handling.rb