mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Remove color_hexcode column from badge_types.
This commit is contained in:
parent
89f45901bc
commit
b62606e7f1
9 changed files with 14 additions and 22 deletions
|
@ -2,7 +2,6 @@ class BadgeType < ActiveRecord::Base
|
|||
has_many :badges
|
||||
|
||||
validates :name, presence: true, uniqueness: true
|
||||
validates :color_hexcode, presence: true
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
|
@ -11,7 +10,6 @@ end
|
|||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) not null
|
||||
# color_hexcode :string(255) not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class BadgeTypeSerializer < ApplicationSerializer
|
||||
attributes :id, :name, :color_hexcode
|
||||
attributes :id, :name
|
||||
end
|
||||
|
|
|
@ -1475,9 +1475,3 @@ en:
|
|||
message_to_blank: "message.to is blank"
|
||||
text_part_body_blank: "text_part.body is blank"
|
||||
body_blank: "body is blank"
|
||||
|
||||
badges:
|
||||
types:
|
||||
gold: Gold
|
||||
silver: Silver
|
||||
bronze: Bronze
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
BadgeType.seed do |b|
|
||||
b.id = 1
|
||||
b.name = I18n.t('badges.types.gold')
|
||||
b.color_hexcode = "ffd700"
|
||||
b.name = "Gold"
|
||||
end
|
||||
|
||||
BadgeType.seed do |b|
|
||||
b.id = 2
|
||||
b.name = I18n.t('badges.types.silver')
|
||||
b.color_hexcode = "c0c0c0"
|
||||
b.name = "Silver"
|
||||
end
|
||||
|
||||
BadgeType.seed do |b|
|
||||
b.id = 3
|
||||
b.name = I18n.t('badges.types.bronze')
|
||||
b.color_hexcode = "cd7f32"
|
||||
b.name = "Bronze"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveColorHexcodeFromBadgeTypes < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :badge_types, :color_hexcode, :string
|
||||
end
|
||||
end
|
|
@ -1,6 +1,5 @@
|
|||
Fabricator(:badge_type) do
|
||||
name { sequence(:name) {|i| "Silver #{i}" } }
|
||||
color_hexcode "c0c0c0"
|
||||
end
|
||||
|
||||
Fabricator(:badge) do
|
||||
|
|
|
@ -5,6 +5,5 @@ describe BadgeType do
|
|||
|
||||
it { should validate_presence_of :name }
|
||||
it { should validate_uniqueness_of :name }
|
||||
it { should validate_presence_of :color_hexcode }
|
||||
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ test('translatedDescription', function() {
|
|||
});
|
||||
|
||||
test('createFromJson array', function() {
|
||||
var badgesJson = {"badge_types":[{"id":6,"name":"Silver 1","color_hexcode":"#c0c0c0"}],"badges":[{"id":1126,"name":"Badge 1","description":null,"badge_type_id":6}]};
|
||||
var badgesJson = {"badge_types":[{"id":6,"name":"Silver 1"}],"badges":[{"id":1126,"name":"Badge 1","description":null,"badge_type_id":6}]};
|
||||
|
||||
var badges = Discourse.Badge.createFromJson(badgesJson);
|
||||
|
||||
|
@ -36,7 +36,7 @@ test('createFromJson array', function() {
|
|||
});
|
||||
|
||||
test('createFromJson single', function() {
|
||||
var badgeJson = {"badge_types":[{"id":6,"name":"Silver 1","color_hexcode":"#c0c0c0"}],"badge":{"id":1126,"name":"Badge 1","description":null,"badge_type_id":6}};
|
||||
var badgeJson = {"badge_types":[{"id":6,"name":"Silver 1"}],"badge":{"id":1126,"name":"Badge 1","description":null,"badge_type_id":6}};
|
||||
|
||||
var badge = Discourse.Badge.createFromJson(badgeJson);
|
||||
|
||||
|
@ -44,7 +44,7 @@ test('createFromJson single', function() {
|
|||
});
|
||||
|
||||
test('updateFromJson', function() {
|
||||
var badgeJson = {"badge_types":[{"id":6,"name":"Silver 1","color_hexcode":"#c0c0c0"}],"badge":{"id":1126,"name":"Badge 1","description":null,"badge_type_id":6}};
|
||||
var badgeJson = {"badge_types":[{"id":6,"name":"Silver 1"}],"badge":{"id":1126,"name":"Badge 1","description":null,"badge_type_id":6}};
|
||||
var badge = Discourse.Badge.create({name: "Badge 1"});
|
||||
badge.updateFromJson(badgeJson);
|
||||
equal(badge.get('id'), 1126, "id is set");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module("Discourse.UserBadge");
|
||||
|
||||
var singleBadgeJson = {"badges":[{"id":874,"name":"Badge 2","description":null,"badge_type_id":7}],"badge_types":[{"id":7,"name":"Silver 2","color_hexcode":"#c0c0c0"}],"users":[{"id":13470,"username":"anne3","avatar_template":"//www.gravatar.com/avatar/a4151b1fd72089c54e2374565a87da7f.png?s={size}\u0026r=pg\u0026d=identicon"}],"user_badge":{"id":665,"granted_at":"2014-03-09T20:30:01.190-04:00","badge_id":874,"granted_by_id":13470}},
|
||||
multipleBadgesJson = {"badges":[{"id":880,"name":"Badge 8","description":null,"badge_type_id":13}],"badge_types":[{"id":13,"name":"Silver 8","color_hexcode":"#c0c0c0"}],"users":[],"user_badges":[{"id":668,"granted_at":"2014-03-09T20:30:01.420-04:00","badge_id":880,"granted_by_id":null}]};
|
||||
var singleBadgeJson = {"badges":[{"id":874,"name":"Badge 2","description":null,"badge_type_id":7}],"badge_types":[{"id":7,"name":"Silver 2"}],"users":[{"id":13470,"username":"anne3","avatar_template":"//www.gravatar.com/avatar/a4151b1fd72089c54e2374565a87da7f.png?s={size}\u0026r=pg\u0026d=identicon"}],"user_badge":{"id":665,"granted_at":"2014-03-09T20:30:01.190-04:00","badge_id":874,"granted_by_id":13470}},
|
||||
multipleBadgesJson = {"badges":[{"id":880,"name":"Badge 8","description":null,"badge_type_id":13}],"badge_types":[{"id":13,"name":"Silver 8"}],"users":[],"user_badges":[{"id":668,"granted_at":"2014-03-09T20:30:01.420-04:00","badge_id":880,"granted_by_id":null}]};
|
||||
|
||||
test('createFromJson single', function() {
|
||||
var userBadge = Discourse.UserBadge.createFromJson(singleBadgeJson);
|
||||
|
|
Loading…
Reference in a new issue