Browse Source

Removes show_hidden and secret_name

Maarten van den Berg 7 years ago
parent
commit
baf294dc1c

+ 1 - 1
app/controllers/activities_controller.rb

@@ -117,6 +117,6 @@ class ActivitiesController < ApplicationController
117 117
 
118 118
     # Never trust parameters from the scary internet, only allow the white list through.
119 119
     def activity_params
120
-      params.require(:activity).permit(:public_name, :secret_name, :description, :location, :start, :end, :deadline, :show_hidden)
120
+      params.require(:activity).permit(:public_name, :description, :location, :start, :end, :deadline)
121 121
     end
122 122
 end

+ 1 - 15
app/models/activity.rb

@@ -3,14 +3,7 @@
3 3
 class Activity < ApplicationRecord
4 4
   # @!attribute public_name
5 5
   #   @return [String]
6
-  #     the name that users will see if there is no {#secret_name}, or if
7
-  #     {#show_hidden} is `false`.
8
-  #
9
-  # @!attribute secret_name
10
-  #   @return [String]
11
-  #     a name that is (be default) only visible to organizers and group
12
-  #     leaders.  Can be shown or hidden to normal participants using
13
-  #     {#show_hidden}.
6
+  #     a short name for the activity.
14 7
   #
15 8
   # @!attribute description
16 9
   #   @return [String]
@@ -22,13 +15,6 @@ class Activity < ApplicationRecord
22 15
   #     a short text describing where the activity will take place. Always
23 16
   #     visible to all participants.
24 17
   #
25
-  # @!attribute show_hidden
26
-  #   @return [Boolean]
27
-  #     Whether or not the 'secret' attributes can be viewed by the people who
28
-  #     aren't organizers or group leaders. Currently, only {#secret_name} is
29
-  #     influenced by this. More attributes may be added in the future, and
30
-  #     will be controlled by this toggle as well.
31
-  #
32 18
   # @!attribute start
33 19
   #   @return [TimeWithZone]
34 20
   #     when the activity starts.

+ 2 - 14
app/views/activities/_form.html.erb

@@ -13,16 +13,8 @@
13 13
 
14 14
   <div class="actions">
15 15
     <div class="form-group">
16
-      <div class="row">
17
-        <div class="col-md-6">
18
-          <%= f.label :public_name %>
19
-          <%= f.text_field :public_name, class: 'form-control' %>
20
-        </div>
21
-        <div class="col-md-6">
22
-          <%= f.label :secret_name %>
23
-          <%= f.text_field :secret_name, class: 'form-control' %>
24
-        </div>
25
-      </div>
16
+      <%= f.label :public_name %>
17
+      <%= f.text_field :public_name, class: 'form-control' %>
26 18
     </div>
27 19
     <div class="form-group">
28 20
       <div class="row">
@@ -44,10 +36,6 @@
44 36
       <%= f.label :deadline %>
45 37
       <%= f.datetime_field :deadline, class: 'form-control' %>
46 38
     </div>
47
-    <div class="form-group">
48
-      <%= f.label :show_hidden %>
49
-      <%= f.check_box :show_hidden %>
50
-    </div>
51 39
     <%= f.submit %>
52 40
   </div>
53 41
 <% end %>

+ 0 - 5
app/views/dashboard/home.html.haml

@@ -27,9 +27,6 @@
27 27
                   %tr{class: p.row_class, data: {activity_id: e.id, person_id: current_person.id}}
28 28
                     %td
29 29
                       = e.public_name
30
-                      - if e.secret_name && e.participants.first.is_organizer
31
-                        %i
32
-                          = "(#{e.secret_name})"
33 30
                     %td
34 31
                       = e.group.name
35 32
                     %td
@@ -67,8 +64,6 @@
67 64
                   %td
68 65
                     = link_to group_activity_url(a.group, a) do
69 66
                       = a.public_name
70
-                      - if a.secret_name
71
-                        = "(#{a.secret_name})"
72 67
                       = render partial: "activities/state_counts", locals: {counts: a.state_counts}
73 68
 
74 69
   .row

+ 13 - 0
db/migrate/20170815155155_remove_secret_name_from_activity.rb

@@ -0,0 +1,13 @@
1
+class RemoveSecretNameFromActivity < ActiveRecord::Migration[5.0]
2
+  def up
3
+    remove_column :activities, :secret_name
4
+    remove_column :activities, :show_hidden
5
+    rename_column :activities, :public_name, :name
6
+  end
7
+
8
+  def down
9
+    rename_column :activities, :name, :public_name
10
+    add_column :activities, :secret_name, :string
11
+    add_column :activities, :show_hidden, :boolean
12
+  end
13
+end

+ 2 - 4
db/schema.rb

@@ -10,17 +10,15 @@
10 10
 #
11 11
 # It's strongly recommended that you check this file into your version control system.
12 12
 
13
-ActiveRecord::Schema.define(version: 20170222104408) do
13
+ActiveRecord::Schema.define(version: 20170815155155) do
14 14
 
15 15
   create_table "activities", force: :cascade do |t|
16
-    t.string   "public_name"
17
-    t.string   "secret_name"
16
+    t.string   "name"
18 17
     t.string   "description"
19 18
     t.string   "location"
20 19
     t.datetime "start"
21 20
     t.datetime "end"
22 21
     t.datetime "deadline"
23
-    t.boolean  "show_hidden"
24 22
     t.integer  "group_id"
25 23
     t.datetime "created_at",  null: false
26 24
     t.datetime "updated_at",  null: false

+ 0 - 10
db/seeds.rb

@@ -52,37 +52,27 @@ end
52 52
 
53 53
 a = Activity.create!(
54 54
   public_name: 'Fikkie stoken ofzo',
55
-  secret_name: 'Bosbrandopkomst',
56 55
   description: 'Een scout trekt er samen met anderen op uit',
57 56
   location: 'In het bos in het bos',
58 57
   start: 4.weeks.since,
59 58
   end: 4.weeks.since + 2.hours,
60 59
   deadline: 3.weeks.since,
61
-  show_hidden: false,
62 60
   group: g
63 61
 )
64 62
 
65 63
 Group.all.each do |g|
66 64
   10.times do |i|
67
-    if Faker::Boolean.boolean(0.25)
68
-      secret_name = Faker::Hacker.ingverb
69
-    else
70
-      secret_name = nil
71
-    end
72
-
73 65
     starttime = Faker::Time.between(DateTime.now, 1.years.since, :morning)
74 66
     endtime   = Faker::Time.between(1.hours.since(starttime), 1.days.since(starttime), :afternoon)
75 67
     deadline  = 5.days.ago(starttime)
76 68
 
77 69
     act = Activity.create!(
78 70
       public_name: Faker::Hacker.ingverb,
79
-      secret_name: secret_name,
80 71
       description: Faker::Hipster.sentence,
81 72
       location: Faker::Address.city,
82 73
       start: starttime,
83 74
       end: endtime,
84 75
       deadline: deadline,
85
-      show_hidden: Faker::Boolean.boolean,
86 76
       group: g
87 77
     )
88 78
   end