Skip to content

Commit

Permalink
Merge pull request #205 from tosdr/enh/issue-201-privacy-related-column
Browse files Browse the repository at this point in the history
[enh] adding privacy related boolean column to topics
  • Loading branch information
piks3l authored Dec 23, 2017
2 parents 9019fe3 + 1d5e0ad commit df30b0e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/topics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def set_topic
end

def topic_params
params.require(:topic).permit(:title, :subtitle, :description, :query)
params.require(:topic).permit(:title, :subtitle, :description, :query, :privacy_related)
end

end
1 change: 1 addition & 0 deletions app/views/services/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="form-inputs col-xs-12">
<%= f.input :name, placeholder: "Service name" %>
<%= f.input :url, placeholder: "Address of the service"%>
<%= f.input :privacy_related, as: :boolean, label: :'privacy related' %>
</div>
<div class="form-actions col-xs-4 col-sm-2 col-md-2">
<%= link_to "Back", :back, class: "btn btn-default" %>
Expand Down
1 change: 1 addition & 0 deletions app/views/topics/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="form-inputs col-xs-12">
<%= f.input :title, placeholder: "Topic title", label: false %>
<%= f.input :subtitle, placeholder: "Subtitle", label: false %>
<%= f.input :privacy_related, as: :boolean, label: 'Privacy related', checked_value: true, unchecked_value: false %>
<%= f.input :description, as: :text , input_html: { rows: 3, class: "text-area" } %>
</div>
</div>
Expand Down
12 changes: 11 additions & 1 deletion app/views/topics/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<header class="tc ph4">
<h1 class="fw2 mv3">
Data Protection Topics
Topics
</h1>
<% if current_user.curator? %>
<%= link_to 'Add Topic', new_topic_path, class: 'btn btn-primary' %>
Expand All @@ -21,6 +21,9 @@
<div class="card-inline-item card-inline-contribution">
Contributions
</div>
<div class="card-inline-item card-inline-contribution">
Privacy related?
</div>
<div class="card-inline-item card-inline-options">
Options
</div>
Expand All @@ -41,6 +44,13 @@
<div class="card-inline-item card-inline-contribution">
<%= t.points.count %>
</div>
<div class="card-inline-item card-inline-contribution">
<% if t.privacy_related? %>
<i class="fa fa-check" aria-hidden="true"></i>
<% else %>
<i class="fa fa-circle-o" aria-hidden="true"></i>
<% end %>
</div>
<div class="card-inline-item card-inline-options">
<%= link_to(topic_path(t), :class => 'btn') do %>
<i class="fa fa-eye" aria-hidden="true"></i>
Expand Down
5 changes: 4 additions & 1 deletion app/views/topics/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<%= @topic.title %>
</h1>
<p class="fw2 mt0 lh-copy">
<%= @topic.subtitle %>
<%= @topic.subtitle %>.
</p>
<p class="fw2 mt0 lh-copy">
Privacy related: <%= @topic.privacy_related? ? "yes" : "no" %>
</p>

<p>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20171223151948_adding_privacy_related_to_topics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddingPrivacyRelatedToTopics < ActiveRecord::Migration[5.1]
def change
add_column :topics, :privacy_related, :boolean
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171220095528) do
ActiveRecord::Schema.define(version: 20171223151948) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -96,6 +96,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "oldId"
t.boolean "privacy_related"
end

create_table "users", force: :cascade do |t|
Expand Down

0 comments on commit df30b0e

Please sign in to comment.