go_gamification 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/go_gamification/flyingcloud.png +0 -0
- data/app/assets/images/go_gamification/hair.png +0 -0
- data/app/assets/images/go_gamification/hair.png~ +0 -0
- data/app/assets/javascripts/gamification/inventories.js +2 -0
- data/app/assets/javascripts/gamification/item_groups.js +2 -0
- data/app/assets/javascripts/gamification/item_types.js +2 -0
- data/app/assets/javascripts/gamification/items.js +2 -0
- data/app/assets/javascripts/go_gamification/character-new.js.erb +1 -13
- data/app/assets/stylesheets/gamification/inventories.css +4 -0
- data/app/assets/stylesheets/gamification/item_groups.css +4 -0
- data/app/assets/stylesheets/gamification/item_types.css +4 -0
- data/app/assets/stylesheets/gamification/items.css +4 -0
- data/app/assets/stylesheets/scaffold.css +80 -0
- data/app/controllers/gamification/inventories_controller.rb +69 -0
- data/app/controllers/gamification/item_groups_controller.rb +58 -0
- data/app/controllers/gamification/item_types_controller.rb +58 -0
- data/app/controllers/gamification/items_controller.rb +58 -0
- data/app/helpers/gamification/inventories_helper.rb +2 -0
- data/app/helpers/gamification/item_groups_helper.rb +2 -0
- data/app/helpers/gamification/item_types_helper.rb +2 -0
- data/app/helpers/gamification/items_helper.rb +2 -0
- data/app/models/gamification/inventory.rb +40 -0
- data/app/models/gamification/item.rb +10 -0
- data/app/models/gamification/item_group.rb +5 -0
- data/app/models/gamification/item_type.rb +5 -0
- data/app/views/gamification/inventories/_form.html.erb +32 -0
- data/app/views/gamification/inventories/_inventory.html.erb +56 -0
- data/app/views/gamification/inventories/edit.html.erb +6 -0
- data/app/views/gamification/inventories/index.html.erb +31 -0
- data/app/views/gamification/inventories/new.html.erb +5 -0
- data/app/views/gamification/inventories/show.html.erb +19 -0
- data/app/views/gamification/inventories/update.js.erb +195 -0
- data/app/views/gamification/item_groups/_form.html.erb +22 -0
- data/app/views/gamification/item_groups/edit.html.erb +6 -0
- data/app/views/gamification/item_groups/index.html.erb +27 -0
- data/app/views/gamification/item_groups/new.html.erb +5 -0
- data/app/views/gamification/item_groups/show.html.erb +9 -0
- data/app/views/gamification/item_types/_collection.html.erb +13 -0
- data/app/views/gamification/item_types/_form.html.erb +14 -0
- data/app/views/gamification/item_types/_pagination.html.erb +4 -0
- data/app/views/gamification/item_types/edit.html.erb +24 -0
- data/app/views/gamification/item_types/index.html.erb +42 -0
- data/app/views/gamification/item_types/new.html.erb +25 -0
- data/app/views/gamification/item_types/show.html.erb +9 -0
- data/app/views/gamification/items/_collection.html.erb +21 -0
- data/app/views/gamification/items/_form.html.erb +23 -0
- data/app/views/gamification/items/_pagination.html.erb +4 -0
- data/app/views/gamification/items/edit.html.erb +6 -0
- data/app/views/gamification/items/index.html.erb +41 -0
- data/app/views/gamification/items/new.html.erb +24 -0
- data/app/views/gamification/items/show.html.erb +39 -0
- data/config/routes.rb +5 -3
- data/db/migrate/20171026222729_create_gamification_item_types.rb +9 -0
- data/db/migrate/20171026223122_create_gamification_items.rb +15 -0
- data/db/migrate/20171026223219_create_gamification_inventories.rb +11 -0
- data/db/migrate/20171027010758_alter_table_go_gamification_item_type_add_key.rb +3 -0
- data/db/migrate/20171028203227_create_gamification_item_groups.rb +9 -0
- data/db/migrate/20171028203324_alter_table_gamificationitem_add_group.rb +5 -0
- data/lib/go_gamification/version.rb +1 -1
- metadata +128 -45
@@ -0,0 +1,195 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
$('#inventory').html('<%= escape_javascript render 'inventory' %>');
|
4
|
+
|
5
|
+
var parts = [
|
6
|
+
{
|
7
|
+
name: 'leftArm',
|
8
|
+
ident: "<%= @user.decorate.equipped_left_arm%>",
|
9
|
+
visible: true,
|
10
|
+
x: charX + 40,
|
11
|
+
y: charY - 42 - breathAmt
|
12
|
+
},
|
13
|
+
{
|
14
|
+
name: 'leftArmjump',
|
15
|
+
ident: "<%= @user.decorate.equipped_left_arm_jump %>",
|
16
|
+
visible: false,
|
17
|
+
x: charX + 40,
|
18
|
+
y: charY - 42 - breathAmt
|
19
|
+
},
|
20
|
+
{name: 'legs', ident: "<%= @user.decorate.equipped_legs %>", visible: true, x: charX, y: charY},
|
21
|
+
{
|
22
|
+
name: 'legsjump',
|
23
|
+
ident: "<%= @user.decorate.equipped_legs_jump%>",
|
24
|
+
visible: false,
|
25
|
+
x: charX,
|
26
|
+
y: charY - 6
|
27
|
+
},
|
28
|
+
{name: 'torso', ident: "<%= @user.decorate.equipped_torso %>", visible: true, x: charX, y: charY - 50},
|
29
|
+
{
|
30
|
+
name: 'head',
|
31
|
+
ident: "<%= @user.decorate.equipped_head %>",
|
32
|
+
visible: true,
|
33
|
+
x: charX - 10,
|
34
|
+
y: charY - 125 - breathAmt
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: 'hair',
|
38
|
+
ident: "<%= @user.decorate.equipped_hair %>",
|
39
|
+
visible: true,
|
40
|
+
x: charX - 37,
|
41
|
+
y: charY - 138 - breathAmt
|
42
|
+
},
|
43
|
+
{
|
44
|
+
name: 'rightArm',
|
45
|
+
ident: "<%= @user.decorate.equipped_right_arm %>",
|
46
|
+
visible: true,
|
47
|
+
x: charX - 15,
|
48
|
+
y: charY - 42 - breathAmt
|
49
|
+
},
|
50
|
+
{
|
51
|
+
name: 'rightArmjump',
|
52
|
+
ident: "<%= @user.decorate.equipped_right_arm_jump %>",
|
53
|
+
visible: false,
|
54
|
+
x: charX - 35,
|
55
|
+
y: charY - 42 - breathAmt
|
56
|
+
},
|
57
|
+
|
58
|
+
];
|
59
|
+
var bodyParts = [];
|
60
|
+
|
61
|
+
var num_of_imgs = parts.length + 2;
|
62
|
+
var loaded_imgs = 0;
|
63
|
+
|
64
|
+
function myLoop() {
|
65
|
+
bg.draw();
|
66
|
+
|
67
|
+
//update the cloud
|
68
|
+
cx = cloud.x - cloudSpeed;
|
69
|
+
|
70
|
+
if (cx + cloud.width < 0) {
|
71
|
+
cx = engine._stageWidth + 20;
|
72
|
+
cy = Math.floor(Math.random() * 50);
|
73
|
+
cloud.y = cy;
|
74
|
+
}
|
75
|
+
|
76
|
+
cloud.x = cx;
|
77
|
+
cloud.draw();
|
78
|
+
|
79
|
+
x = charX;
|
80
|
+
y = charY;
|
81
|
+
|
82
|
+
if (isJumping) {
|
83
|
+
y -= jumpHeight;
|
84
|
+
}
|
85
|
+
|
86
|
+
character.y = y;
|
87
|
+
// Update parts for breathing
|
88
|
+
bodyParts.head.y = charY - 125 - breathAmt;
|
89
|
+
bodyParts.hair.y = charY - 138 - breathAmt;
|
90
|
+
|
91
|
+
if (isJumping) {
|
92
|
+
bodyParts.leftArmjump.visible = true;
|
93
|
+
bodyParts.rightArmjump.visible = true;
|
94
|
+
bodyParts.legsjump.visible = true;
|
95
|
+
|
96
|
+
bodyParts.leftArm.visible = false;
|
97
|
+
bodyParts.rightArm.visible = false;
|
98
|
+
bodyParts.legs.visible = false;
|
99
|
+
} else {
|
100
|
+
bodyParts.leftArmjump.visible = false;
|
101
|
+
bodyParts.rightArmjump.visible = false;
|
102
|
+
bodyParts.legsjump.visible = false;
|
103
|
+
|
104
|
+
bodyParts.leftArm.visible = true;
|
105
|
+
bodyParts.rightArm.visible = true;
|
106
|
+
bodyParts.legs.visible = true;
|
107
|
+
|
108
|
+
bodyParts.leftArm.y = charY - 42 - breathAmt;
|
109
|
+
bodyParts.rightArm.y = charY - 42 - breathAmt;
|
110
|
+
}
|
111
|
+
|
112
|
+
bodyParts.leftEye.y = charY - 68 - breathAmt;
|
113
|
+
bodyParts.rightEye.y = charY - 68 - breathAmt;
|
114
|
+
|
115
|
+
eyeOpenTime += blinkUpdateTime;
|
116
|
+
|
117
|
+
if (eyeOpenTime >= timeBtwBlinks) {
|
118
|
+
blink();
|
119
|
+
}
|
120
|
+
|
121
|
+
bodyParts.leftEye.height = curEyeHeight;
|
122
|
+
bodyParts.rightEye.height = curEyeHeight;
|
123
|
+
|
124
|
+
character.draw();
|
125
|
+
fps_text.text = "Current FPS: " + engine.getFPS();
|
126
|
+
fps_text.draw();
|
127
|
+
updateBreath();
|
128
|
+
}
|
129
|
+
|
130
|
+
$(document).ready(function () {
|
131
|
+
|
132
|
+
|
133
|
+
character = engine.createClip({
|
134
|
+
x: charX,
|
135
|
+
y: charY
|
136
|
+
});
|
137
|
+
|
138
|
+
for (part in parts) {
|
139
|
+
o = parts[part];
|
140
|
+
bodyParts[o.name] = engine.createBitmap({
|
141
|
+
src: o.ident,
|
142
|
+
x: o.x,
|
143
|
+
y: o.y,
|
144
|
+
visible: o.visible
|
145
|
+
});
|
146
|
+
|
147
|
+
bodyParts[o.name].addEventListener('onload', increaseLoaded);
|
148
|
+
character.add(bodyParts[o.name]);
|
149
|
+
}
|
150
|
+
|
151
|
+
bodyParts['leftEye'] = engine.createShape({
|
152
|
+
shape: 'elipse',
|
153
|
+
style: 'filled',
|
154
|
+
x: charX + 47,
|
155
|
+
y: charY - 68 - breathAmt,
|
156
|
+
width: 8,
|
157
|
+
height: curEyeHeight,
|
158
|
+
});
|
159
|
+
|
160
|
+
bodyParts['rightEye'] = engine.createShape({
|
161
|
+
shape: 'elipse',
|
162
|
+
style: 'filled',
|
163
|
+
x: charX + 58,
|
164
|
+
y: charY - 68 - breathAmt,
|
165
|
+
width: 8,
|
166
|
+
height: curEyeHeight
|
167
|
+
});
|
168
|
+
|
169
|
+
character.add(bodyParts['leftEye']);
|
170
|
+
character.add(bodyParts['rightEye']);
|
171
|
+
|
172
|
+
bg = engine.createBitmap({
|
173
|
+
src: "<%= @user.decorate.equipped_background %>",
|
174
|
+
x: 0,
|
175
|
+
y: 0
|
176
|
+
});
|
177
|
+
|
178
|
+
bg.addEventListener('onload', increaseLoaded);
|
179
|
+
|
180
|
+
cloud = engine.createBitmap({
|
181
|
+
src: "<%=@user.decorate.equipped_flyingobject %>",
|
182
|
+
x: engine._stageWidth + 20,
|
183
|
+
y: 80
|
184
|
+
});
|
185
|
+
|
186
|
+
cloud.addEventListener('onload', increaseLoaded);
|
187
|
+
|
188
|
+
fps_text = engine.createText({
|
189
|
+
text: "FPS",
|
190
|
+
color: 'rgba(255,255,255,1)',
|
191
|
+
x: 20,
|
192
|
+
y: 20
|
193
|
+
});
|
194
|
+
|
195
|
+
});
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_with(model: gamification_item_group, local: true) do |form| %>
|
2
|
+
<% if gamification_item_group.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(gamification_item_group.errors.count, "error") %> prohibited this gamification_item_group from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% gamification_item_group.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= form.label :name %>
|
16
|
+
<%= form.text_field :name, id: :gamification_item_group_name %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="actions">
|
20
|
+
<%= form.submit %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Gamification Item Groups</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Name</th>
|
9
|
+
<th colspan="3"></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<% @gamification_item_groups.each do |gamification_item_group| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= gamification_item_group.name %></td>
|
17
|
+
<td><%= link_to 'Show', gamification_item_group %></td>
|
18
|
+
<td><%= link_to 'Edit', edit_gamification_item_group_path(gamification_item_group) %></td>
|
19
|
+
<td><%= link_to 'Destroy', gamification_item_group, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<br>
|
26
|
+
|
27
|
+
<%= link_to 'New Gamification Item Group', new_gamification_item_group_path %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% collection.each do |resource| %>
|
2
|
+
<tr id="<%= dom_id(resource) %>">
|
3
|
+
<td><%= resource.name %></td>
|
4
|
+
<td class="text-center">
|
5
|
+
<% if current_user and current_user.admin? %>
|
6
|
+
<%= link_to 'Show', resource %>
|
7
|
+
<%= link_to 'Edit', edit_gamification_item_type_path(resource) %>
|
8
|
+
<%= link_to 'Destroy', resource, method: :delete, data: { confirm: 'Are you sure?' } %>
|
9
|
+
<% end %>
|
10
|
+
</td>
|
11
|
+
</td>
|
12
|
+
</tr>
|
13
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
<%= simple_form_for(@gamification_item_type) do |f| %>
|
3
|
+
<%= f.error_notification %>
|
4
|
+
|
5
|
+
<div class="form-inputs">
|
6
|
+
<%= f.input :name %>
|
7
|
+
<%= f.input :key %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-group form-actions">
|
11
|
+
<%= link_to I18n.t('misc.action.back'), gamification_item_types_path, class: 'btn btn-sm btn-square btn-default' %>
|
12
|
+
<%= f.button :submit, class: 'btn btn-sm btn-square btn-primary' %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= provide :page_title, I18n.t('link_categories.new.header') %>
|
2
|
+
<%= provide :breadcrumb do %>
|
3
|
+
<li><%= link_to t('activerecord.models.link.other'), gamification_item_types_path %></li>
|
4
|
+
<li><%=t 'links.new.header' %></li>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<main id="main-container" style="min-height: 530px;">
|
8
|
+
<div class="content bg-gray-lighter">
|
9
|
+
<div class="row items-push">
|
10
|
+
<div class="col-sm-7">
|
11
|
+
<h1 class="page-heading">
|
12
|
+
<%= I18n.t('links.new.title') %>
|
13
|
+
</h1>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<div class="content">
|
18
|
+
<div class="block">
|
19
|
+
<div class="block-content">
|
20
|
+
<%= render 'form' %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</main>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
<%= provide :page_title, I18n.t('links.index.header') %>
|
3
|
+
<%= provide :breadcrumb do %>
|
4
|
+
<li><%= I18n.t('activerecord.models.link.other') %></li>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<main id="main-container" style="min-height: 530px;">
|
8
|
+
<div class="content bg-gray-lighter">
|
9
|
+
<div class="row items-push">
|
10
|
+
<div class="col-sm-7">
|
11
|
+
<h1 class="page-heading">
|
12
|
+
<%= t('links.index.title') %>
|
13
|
+
</h1>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<div class="content">
|
18
|
+
<div class="block">
|
19
|
+
<div class="block-header text-right">
|
20
|
+
<h3 class="block-title">
|
21
|
+
</h3>
|
22
|
+
<span >
|
23
|
+
<%= link_to I18n.t('links.new.header'), new_gamification_item_type_path, class: 'btn btn-sm btn-square btn-success' %>
|
24
|
+
</span>
|
25
|
+
</div>
|
26
|
+
<div class="block-content">
|
27
|
+
<table class="table table-striped">
|
28
|
+
<thead>
|
29
|
+
<tr>
|
30
|
+
<th><%=t 'activerecord.attributes.link.name' %></th>
|
31
|
+
<th class="text-center" style="width: 150px;"><%=t 'misc.actions' %></th>
|
32
|
+
</tr>
|
33
|
+
</thead>
|
34
|
+
<tbody id='link_categories'>
|
35
|
+
<%= render 'collection', collection: @gamification_item_types %>
|
36
|
+
</tbody>
|
37
|
+
</table>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</main>
|
42
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
<%= provide :page_title, I18n.t('links.new.header') %>
|
3
|
+
<%= provide :breadcrumb do %>
|
4
|
+
<li><%= link_to t('activerecord.models.link.other'), gamification_item_types_path %></li>
|
5
|
+
<li><%=t 'links.new.header' %></li>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<main id="main-container" style="min-height: 530px;">
|
9
|
+
<div class="content bg-gray-lighter">
|
10
|
+
<div class="row items-push">
|
11
|
+
<div class="col-sm-7">
|
12
|
+
<h1 class="page-heading">
|
13
|
+
<%= I18n.t('links.new.title') %>
|
14
|
+
</h1>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div class="content">
|
19
|
+
<div class="block">
|
20
|
+
<div class="block-content">
|
21
|
+
<%= render 'form' %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</main>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% collection.each do |resource| %>
|
2
|
+
<tr id="<%= dom_id(resource) %>">
|
3
|
+
<td><%= resource.name %></td>
|
4
|
+
<td><%= resource.item_type %></td>
|
5
|
+
<td> <%= image_tag resource.image.icon32 %></td>
|
6
|
+
<td><%= resource.rarity %></td>
|
7
|
+
<td><%= resource.cost %></td>
|
8
|
+
<td><%= resource.user.name %></td>
|
9
|
+
<td><%= resource.description %></td>
|
10
|
+
<td class="text-center">
|
11
|
+
<% if current_user and current_user.admin? %>
|
12
|
+
<%= link_to 'Show', resource %>
|
13
|
+
<%= link_to 'Edit', edit_gamification_item_path(resource) %>
|
14
|
+
<%= link_to 'Destroy', resource, method: :delete, data: { confirm: 'Are you sure?' } %>
|
15
|
+
<% end %>
|
16
|
+
</td>
|
17
|
+
</td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= simple_form_for(@gamification_item) do |f| %>
|
2
|
+
<%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="field">
|
5
|
+
<%= f.input :name, id: :gamification_item_name %>
|
6
|
+
<%= f.input :description, id: :gamification_item_description %>
|
7
|
+
<%= f.input :gamification_item_type_id,:collection => Gamification::ItemType.all,:value_method => :id,:label => "Tipo" ,:include_blank => false %>
|
8
|
+
<%= f.input :gamification_item_group_id,:collection => Gamification::ItemGroup.all,:value_method => :id,:label => "Grupo" ,:include_blank => false %>
|
9
|
+
|
10
|
+
<%= f.select :rarity, [['Comum', 1], ['Raro', 2], ['Super Raro', 3], ['Ultra Raro', 4], ['Secreto Raro', 5], ['Ultimate Raro', 6]] %>
|
11
|
+
|
12
|
+
<%= f.input :cost, id: :gamification_item_cost %>
|
13
|
+
|
14
|
+
<%= f.input :user_id,:collection => User.all,:value_method => :id,:label => "User" ,:include_blank => false %>
|
15
|
+
|
16
|
+
<%= f.file_field :image %>
|
17
|
+
|
18
|
+
<%= f.submit %>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%= provide :page_title, I18n.t('links.index.header') %>
|
2
|
+
<%= provide :breadcrumb do %>
|
3
|
+
<li><%= I18n.t('activerecord.models.link.other') %></li>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<main id="main-container" style="min-height: 530px;">
|
7
|
+
<div class="content bg-gray-lighter">
|
8
|
+
<div class="row items-push">
|
9
|
+
<div class="col-sm-7">
|
10
|
+
<h1 class="page-heading">
|
11
|
+
<%= t('links.index.title') %>
|
12
|
+
</h1>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="content">
|
17
|
+
<div class="block">
|
18
|
+
<div class="block-header text-right">
|
19
|
+
<h3 class="block-title">
|
20
|
+
</h3>
|
21
|
+
<span >
|
22
|
+
<%= link_to I18n.t('links.new.header'), new_gamification_item_path, class: 'btn btn-sm btn-square btn-success' %>
|
23
|
+
</span>
|
24
|
+
</div>
|
25
|
+
<div class="block-content">
|
26
|
+
<table class="table table-striped">
|
27
|
+
<thead>
|
28
|
+
<tr>
|
29
|
+
<th><%=t 'activerecord.attributes.link.name' %></th>
|
30
|
+
<th class="text-center" style="width: 150px;"><%=t 'misc.actions' %></th>
|
31
|
+
</tr>
|
32
|
+
</thead>
|
33
|
+
<tbody id='link_categories'>
|
34
|
+
<%= render 'collection', collection: @gamification_items %>
|
35
|
+
</tbody>
|
36
|
+
</table>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</main>
|
41
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= provide :page_title, I18n.t('links.new.header') %>
|
2
|
+
<%= provide :breadcrumb do %>
|
3
|
+
<li><%= link_to t('activerecord.models.link.other'), gamification_items_path %></li>
|
4
|
+
<li><%=t 'links.new.header' %></li>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<main id="main-container" style="min-height: 530px;">
|
8
|
+
<div class="content bg-gray-lighter">
|
9
|
+
<div class="row items-push">
|
10
|
+
<div class="col-sm-7">
|
11
|
+
<h1 class="page-heading">
|
12
|
+
<%= I18n.t('links.new.title') %>
|
13
|
+
</h1>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<div class="content">
|
18
|
+
<div class="block">
|
19
|
+
<div class="block-content">
|
20
|
+
<%= render 'form' %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</main>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Name:</strong>
|
5
|
+
<%= @gamification_item.name %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Itemtype:</strong>
|
10
|
+
<%= @gamification_item.item_type %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Image:</strong>
|
15
|
+
<%= @gamification_item.image %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<strong>Rarity:</strong>
|
20
|
+
<%= @gamification_item.rarity %>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<p>
|
24
|
+
<strong>Cost:</strong>
|
25
|
+
<%= @gamification_item.cost %>
|
26
|
+
</p>
|
27
|
+
|
28
|
+
<p>
|
29
|
+
<strong>User:</strong>
|
30
|
+
<%= @gamification_item.user_id %>
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<p>
|
34
|
+
<strong>Description:</strong>
|
35
|
+
<%= @gamification_item.description %>
|
36
|
+
</p>
|
37
|
+
|
38
|
+
<%= link_to 'Edit', edit_gamification_item_path(@gamification_item) %> |
|
39
|
+
<%= link_to 'Back', gamification_items_path %>
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateGamificationItems < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :gamification_items do |t|
|
4
|
+
t.string :name
|
5
|
+
t.references :gamification_item_type, foreign_key: true
|
6
|
+
t.string :image
|
7
|
+
t.integer :rarity
|
8
|
+
t.numeric :cost
|
9
|
+
t.integer :user_id
|
10
|
+
t.text :description
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateGamificationInventories < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :gamification_inventories do |t|
|
4
|
+
t.integer :user_id
|
5
|
+
t.references :gamification_item, foreign_key: true
|
6
|
+
t.boolean :equipped
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|