Skip to content
Snippets Groups Projects
Commit 9153a41b authored by Taico Aerts's avatar Taico Aerts
Browse files

Merge branch 'eip-develop' into eip-master

parents c15cdc1c e9361423
Branches
No related tags found
1 merge request!81Fix the number of searches graph
......@@ -21,6 +21,7 @@ class BadgesController < ApplicationController
respond_to do |format|
if @badge.save
Rails.cache.delete 'network/badges/badge_ids'
format.html { redirect_to badges_url, notice: 'Badge was successfully created.' }
format.json { render :show, status: :created, location: @badge }
else
......@@ -34,6 +35,7 @@ class BadgesController < ApplicationController
def update
respond_to do |format|
if @badge.update(badge_params)
Rails.cache.delete 'network/badges/badge_ids'
format.html { redirect_to badges_url, notice: 'Badge was successfully updated.' }
format.json { render :show, status: :ok, location: @badge }
else
......@@ -46,6 +48,7 @@ class BadgesController < ApplicationController
# DELETE /badges/1 or /badges/1.json
def destroy
@badge.destroy
Rails.cache.delete 'network/badges/badge_ids'
respond_to do |format|
format.html { redirect_to badges_url, notice: 'Badge was successfully destroyed.' }
......@@ -80,6 +83,9 @@ class BadgesController < ApplicationController
when 'User'
@user_badge.reference_url = Rails.application.routes.path_for(controller: 'users', action: 'show',
id: @user_badge.badge_source_id)
when 'Tag'
@user_badge.reference_url = Rails.application.routes.path_for(controllers: 'tags', action: 'show',
id: @user_badge.badge_source_id)
else
@user_badge.reference_url = ''
end
......@@ -105,7 +111,7 @@ class BadgesController < ApplicationController
# Defines the available types of association for the UserBadge polymorphic relationship
def badge_source_types
%w[Post User]
%w[Post User Tag]
end
# Only allow a list of trusted parameters through.
......
......
......@@ -15,7 +15,7 @@
Select which badge should be awarded. In case you want to create a new badge, you can do so
<%= link_to "here", new_badge_path, class: 'link is-underlined', target: "_blank", 'aria-label': 'Add new badge' %>
</span>
<%= f.select :badge, options_for_select(Badge.where(:manually_awardable => true).mapping.to_a, selected: []),
<%= f.select :badge, options_for_select(Badge.where(manually_awardable: true).pluck(:title, :id), selected: []),
{ include_blank: false }, multiple: false, class: 'form-element' %>
</div>
......@@ -32,7 +32,7 @@
<div class="grid--cell is-6 is-12-sm">
<div class="form-caption">Entity Type</div>
<%= f.select :badge_source_type, options_for_select(@entity_types, selected: []),
{ include_blank: false }, class: 'form-element' %>
{ include_blank: true }, class: 'form-element' %>
</div>
<div class="grid--cell is-6 is-12-sm">
<div class="form-caption">Id of the entity</div>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment