go_gamification 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 891047e4cc20a13870e6411b625a999bafdd0a4c
|
4
|
+
data.tar.gz: d36badf7343ee4a6346e6253fd082da9f05a9baa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2616722fffb3a7c6cacbb62249351923c307ce169105c4acf014402fbd94046112a0d12fc35fb305d48fa04a4047a4d3bc03b2536edfb2583679fcdb1ff1e8c6
|
7
|
+
data.tar.gz: e5b406939097c5688237bcd298a23513254a2e5065c1f6ffd3a1d8c6e864ff520e71bff24603f2f13528a84afe783e30be7f5e85c3e06fd9cb278bb63e41145d
|
Binary file
|
Binary file
|
Binary file
|
@@ -18,18 +18,6 @@ var isJumping = false;
|
|
18
18
|
var jumpHeight = 45;
|
19
19
|
var cloudSpeed = 0.5;
|
20
20
|
|
21
|
-
var parts = [
|
22
|
-
{name: 'leftArm',ident: "<%= asset_path 'go_gamification/leftArm' %>", visible: true, x: charX + 40, y: charY - 42 - breathAmt},
|
23
|
-
{name:'leftArmjump',ident: "<%= asset_path 'go_gamification/leftArm-jump' %>", visible: false, x: charX + 40, y: charY - 42 - breathAmt},
|
24
|
-
{name: 'legs',ident: "<%= asset_path 'go_gamification/legs' %>", visible: true, x: charX, y: charY},
|
25
|
-
{name: 'legsjump',ident: "<%= asset_path 'go_gamification/legs-jump' %>", visible: false, x: charX, y: charY-6},
|
26
|
-
{name: 'torso',ident: "<%= asset_path 'go_gamification/torso' %>", visible: true, x: charX, y: charY - 50},
|
27
|
-
{name: 'head',ident: "<%= asset_path 'go_gamification/head' %>", visible: true, x: charX - 10, y: charY - 125 - breathAmt},
|
28
|
-
{name: 'hair',ident: "<%= asset_path 'go_gamification/hair' %>", visible: true, x: charX - 37, y: charY - 138 - breathAmt},
|
29
|
-
{name: 'rightArm',ident: "<%= asset_path 'go_gamification/rightArm' %>", visible: true, x: charX - 15, y: charY - 42 - breathAmt},
|
30
|
-
{name: 'rightArmjump',ident: "<%= asset_path 'go_gamification/rightArm-jump' %>", visible: false, x: charX - 35, y: charY - 42 - breathAmt},
|
31
|
-
|
32
|
-
];
|
33
21
|
|
34
22
|
var bodyParts = [];
|
35
23
|
|
@@ -44,7 +32,7 @@ function myLoop() {
|
|
44
32
|
|
45
33
|
if(cx+cloud.width < 0) {
|
46
34
|
cx = engine._stageWidth + 20;
|
47
|
-
cy = Math.floor(Math.random()*
|
35
|
+
cy = Math.floor(Math.random()*50);
|
48
36
|
cloud.y = cy;
|
49
37
|
}
|
50
38
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px;
|
5
|
+
}
|
6
|
+
|
7
|
+
body, p, ol, ul, td {
|
8
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
+
font-size: 13px;
|
10
|
+
line-height: 18px;
|
11
|
+
}
|
12
|
+
|
13
|
+
pre {
|
14
|
+
background-color: #eee;
|
15
|
+
padding: 10px;
|
16
|
+
font-size: 11px;
|
17
|
+
}
|
18
|
+
|
19
|
+
a {
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
|
23
|
+
a:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
|
27
|
+
a:hover {
|
28
|
+
color: #fff;
|
29
|
+
background-color: #000;
|
30
|
+
}
|
31
|
+
|
32
|
+
th {
|
33
|
+
padding-bottom: 5px;
|
34
|
+
}
|
35
|
+
|
36
|
+
td {
|
37
|
+
padding: 0 5px 7px;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.field,
|
41
|
+
div.actions {
|
42
|
+
margin-bottom: 10px;
|
43
|
+
}
|
44
|
+
|
45
|
+
#notice {
|
46
|
+
color: green;
|
47
|
+
}
|
48
|
+
|
49
|
+
.field_with_errors {
|
50
|
+
padding: 2px;
|
51
|
+
background-color: red;
|
52
|
+
display: table;
|
53
|
+
}
|
54
|
+
|
55
|
+
#error_explanation {
|
56
|
+
width: 450px;
|
57
|
+
border: 2px solid red;
|
58
|
+
padding: 7px 7px 0;
|
59
|
+
margin-bottom: 20px;
|
60
|
+
background-color: #f0f0f0;
|
61
|
+
}
|
62
|
+
|
63
|
+
#error_explanation h2 {
|
64
|
+
text-align: left;
|
65
|
+
font-weight: bold;
|
66
|
+
padding: 5px 5px 5px 15px;
|
67
|
+
font-size: 12px;
|
68
|
+
margin: -7px -7px 0;
|
69
|
+
background-color: #c00;
|
70
|
+
color: #fff;
|
71
|
+
}
|
72
|
+
|
73
|
+
#error_explanation ul li {
|
74
|
+
font-size: 12px;
|
75
|
+
list-style: square;
|
76
|
+
}
|
77
|
+
|
78
|
+
label {
|
79
|
+
display: block;
|
80
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
class Gamification::InventoriesController < ApplicationController
|
2
|
+
before_action :set_gamification_inventory, only: [:show, :edit, :update, :destroy]
|
3
|
+
before_action :set_user, only: [:update]
|
4
|
+
|
5
|
+
# GET /gamification/inventories
|
6
|
+
def index
|
7
|
+
@gamification_inventories = Gamification::Inventory.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /gamification/inventories/1
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /gamification/inventories/new
|
15
|
+
def new
|
16
|
+
@gamification_inventory = Gamification::Inventory.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /gamification/inventories/1/edit
|
20
|
+
def edit
|
21
|
+
end
|
22
|
+
|
23
|
+
# POST /gamification/inventories
|
24
|
+
def create
|
25
|
+
@gamification_inventory = Gamification::Inventory.new(inventory_params)
|
26
|
+
|
27
|
+
if @gamification_inventory.save
|
28
|
+
redirect_to @gamification_inventory, notice: 'Inventory was successfully created.'
|
29
|
+
else
|
30
|
+
render :new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# PATCH/PUT /gamification/inventories/1
|
35
|
+
def update
|
36
|
+
respond_to do |format|
|
37
|
+
if @gamification_inventory.equip_item(params[:user_id].to_i)
|
38
|
+
|
39
|
+
format.js
|
40
|
+
format.json { head :no_content }
|
41
|
+
else
|
42
|
+
format.js
|
43
|
+
format.json { render json: @gamification_inventory.errors, status: :unprocessable_entity }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# DELETE /gamification/inventories/1
|
49
|
+
def destroy
|
50
|
+
@gamification_inventory.destroy
|
51
|
+
redirect_to gamification_inventories_url, notice: 'Inventory was successfully destroyed.'
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
# Use callbacks to share common setup or constraints between actions.
|
56
|
+
def set_gamification_inventory
|
57
|
+
@gamification_inventory = Gamification::Inventory.find(params[:id])
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_user
|
61
|
+
@user = User.find(params[:user_id])
|
62
|
+
end
|
63
|
+
|
64
|
+
# Only allow a trusted parameter "white list" through.
|
65
|
+
|
66
|
+
def inventory_params
|
67
|
+
params.require(:inventory).permit(:user_id, :equipped, :gamification_item_id)
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class Gamification::ItemGroupsController < ApplicationController
|
2
|
+
before_action :set_gamification_item_group, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /gamification/item_groups
|
5
|
+
def index
|
6
|
+
@gamification_item_groups = Gamification::ItemGroup.all
|
7
|
+
end
|
8
|
+
|
9
|
+
# GET /gamification/item_groups/1
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /gamification/item_groups/new
|
14
|
+
def new
|
15
|
+
@gamification_item_group = Gamification::ItemGroup.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /gamification/item_groups/1/edit
|
19
|
+
def edit
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /gamification/item_groups
|
23
|
+
def create
|
24
|
+
@gamification_item_group = Gamification::ItemGroup.new(gamification_item_group_params)
|
25
|
+
|
26
|
+
if @gamification_item_group.save
|
27
|
+
redirect_to @gamification_item_group, notice: 'Item group was successfully created.'
|
28
|
+
else
|
29
|
+
render :new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# PATCH/PUT /gamification/item_groups/1
|
34
|
+
def update
|
35
|
+
if @gamification_item_group.update(gamification_item_group_params)
|
36
|
+
redirect_to @gamification_item_group, notice: 'Item group was successfully updated.'
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# DELETE /gamification/item_groups/1
|
43
|
+
def destroy
|
44
|
+
@gamification_item_group.destroy
|
45
|
+
redirect_to gamification_item_groups_url, notice: 'Item group was successfully destroyed.'
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
50
|
+
def set_gamification_item_group
|
51
|
+
@gamification_item_group = Gamification::ItemGroup.find(params[:id])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Only allow a trusted parameter "white list" through.
|
55
|
+
def gamification_item_group_params
|
56
|
+
params.require(:gamification_item_group).permit(:name)
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class Gamification::ItemTypesController < ApplicationController
|
2
|
+
before_action :set_gamification_item_type, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /gamification/item_types
|
5
|
+
def index
|
6
|
+
@gamification_item_types = Gamification::ItemType.all
|
7
|
+
end
|
8
|
+
|
9
|
+
# GET /gamification/item_types/1
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /gamification/item_types/new
|
14
|
+
def new
|
15
|
+
@gamification_item_type = Gamification::ItemType.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /gamification/item_types/1/edit
|
19
|
+
def edit
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /gamification/item_types
|
23
|
+
def create
|
24
|
+
@gamification_item_type = Gamification::ItemType.new(gamification_item_type_params)
|
25
|
+
|
26
|
+
if @gamification_item_type.save
|
27
|
+
redirect_to @gamification_item_type, notice: 'Item type was successfully created.'
|
28
|
+
else
|
29
|
+
render :new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# PATCH/PUT /gamification/item_types/1
|
34
|
+
def update
|
35
|
+
if @gamification_item_type.update(gamification_item_type_params)
|
36
|
+
redirect_to @gamification_item_type, notice: 'Item type was successfully updated.'
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# DELETE /gamification/item_types/1
|
43
|
+
def destroy
|
44
|
+
@gamification_item_type.destroy
|
45
|
+
redirect_to gamification_item_types_url, notice: 'Item type was successfully destroyed.'
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
50
|
+
def set_gamification_item_type
|
51
|
+
@gamification_item_type = Gamification::ItemType.find(params[:id])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Only allow a trusted parameter "white list" through.
|
55
|
+
def gamification_item_type_params
|
56
|
+
params.require(:gamification_item_type).permit(:name,:key)
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class Gamification::ItemsController < ApplicationController
|
2
|
+
before_action :set_gamification_item, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /gamification/items
|
5
|
+
def index
|
6
|
+
@gamification_items = Gamification::Item.all
|
7
|
+
end
|
8
|
+
|
9
|
+
# GET /gamification/items/1
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /gamification/items/new
|
14
|
+
def new
|
15
|
+
@gamification_item = Gamification::Item.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /gamification/items/1/edit
|
19
|
+
def edit
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /gamification/items
|
23
|
+
def create
|
24
|
+
@gamification_item = Gamification::Item.new(gamification_item_params)
|
25
|
+
|
26
|
+
if @gamification_item.save
|
27
|
+
redirect_to @gamification_item, notice: 'Item was successfully created.'
|
28
|
+
else
|
29
|
+
render :new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# PATCH/PUT /gamification/items/1
|
34
|
+
def update
|
35
|
+
if @gamification_item.update(gamification_item_params)
|
36
|
+
redirect_to @gamification_item, notice: 'Item was successfully updated.'
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# DELETE /gamification/items/1
|
43
|
+
def destroy
|
44
|
+
@gamification_item.destroy
|
45
|
+
redirect_to gamification_items_url, notice: 'Item was successfully destroyed.'
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
50
|
+
def set_gamification_item
|
51
|
+
@gamification_item = Gamification::Item.find(params[:id])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Only allow a trusted parameter "white list" through.
|
55
|
+
def gamification_item_params
|
56
|
+
params.require(:gamification_item).permit(:name, :gamification_item_type_id,:gamification_item_group_id, :image, :rarity, :cost,:user_id, :description)
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Gamification
|
2
|
+
class Inventory < ApplicationRecord
|
3
|
+
belongs_to :user
|
4
|
+
belongs_to :item, class_name: 'Gamification::Item', foreign_key: :gamification_item_id
|
5
|
+
|
6
|
+
scope :equipped, -> {where equipped: true}
|
7
|
+
|
8
|
+
def unnequip_same_type_item(user_id)
|
9
|
+
Inventory.where(user_id: user_id,gamification_items: {gamification_item_type_id: self.item.item_type.id}).joins(:item).update_all(equipped: false)
|
10
|
+
end
|
11
|
+
|
12
|
+
def unnequip_same_associated_jump_item(user_id)
|
13
|
+
if self.item.item_type
|
14
|
+
unequip_inventory = Inventory.where(user_id: user_id,gamification_item_types: {key: self.item.item_type.key + "jump"})
|
15
|
+
.joins(item: :item_group).joins(item: :item_type)
|
16
|
+
if unequip_inventory.any?
|
17
|
+
unequip_inventory.update_all(equipped: false)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def equipe_associated_jump_item(user_id)
|
23
|
+
if self.item.item_group
|
24
|
+
inventory = Inventory.where.not(id: self.id).where(user_id: user_id,gamification_item_groups: {id: self.item.item_group.id}).where(gamification_item_types: {key: self.item.item_type.key + "jump"})
|
25
|
+
.joins(item: :item_group).joins(item: :item_type)
|
26
|
+
if inventory.any?
|
27
|
+
inventory.update_all(:equipped => true)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def equip_item(user_id)
|
33
|
+
unnequip_same_type_item(user_id)
|
34
|
+
unnequip_same_associated_jump_item(user_id)
|
35
|
+
equipe_associated_jump_item(user_id)
|
36
|
+
self.update_attributes(:equipped => true)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Gamification
|
2
|
+
class Item < ApplicationRecord
|
3
|
+
belongs_to :item_type,class_name: 'Gamification::ItemType',foreign_key: :gamification_item_type_id
|
4
|
+
belongs_to :item_group,class_name: 'Gamification::ItemGroup',foreign_key: :gamification_item_group_id
|
5
|
+
belongs_to :user
|
6
|
+
has_many :inventories,class_name: 'Gamification::Inventory',foreign_key: :gamification_item_id
|
7
|
+
|
8
|
+
mount_uploader :image, ImageUploader
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%= form_with(model: gamification_inventory, local: true) do |form| %>
|
2
|
+
<% if gamification_inventory.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(gamification_inventory.errors.count, "error") %> prohibited this gamification_inventory from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% gamification_inventory.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 :User_id %>
|
16
|
+
<%= form.text_field :User_id, id: :gamification_inventory_User_id %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= form.label :Item_id %>
|
21
|
+
<%= form.text_field :Item_id, id: :gamification_inventory_Item_id %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="field">
|
25
|
+
<%= form.label :equipped %>
|
26
|
+
<%= form.check_box :equipped, id: :gamification_inventory_equipped %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="actions">
|
30
|
+
<%= form.submit %>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<div id="inventory">
|
2
|
+
<div class="col-sm-7 col-sm-pull-5 col-lg-8 col-lg-pull-4">
|
3
|
+
<div class="block block-opt-refresh-icon6">
|
4
|
+
<div class="block-header">
|
5
|
+
<ul class="block-options">
|
6
|
+
<li>
|
7
|
+
<button type="button" data-toggle="block-option" data-action="fullscreen_toggle">
|
8
|
+
<i class="si si-size-fullscreen"></i></button>
|
9
|
+
</li>
|
10
|
+
<li>
|
11
|
+
<button type="button" data-toggle="block-option" data-action="refresh_toggle" data-action-mode="demo">
|
12
|
+
<i class="si si-refresh"></i></button>
|
13
|
+
</li>
|
14
|
+
</ul>
|
15
|
+
<h3 class="block-title"><i class="fa fa-newspaper-o"></i> Inventario</h3>
|
16
|
+
</div>
|
17
|
+
<div class="block-content">
|
18
|
+
<div class="block">
|
19
|
+
<div class="block-content">
|
20
|
+
<div class="row">
|
21
|
+
<% Gamification::ItemType.where("key not in('legsjump','rightarmjump','leftarmjump')").select(:key).distinct.order(key: :asc).each do |item_type| %>
|
22
|
+
<% Gamification::Inventory.where(user_id: @user.id, gamification_item_types: {key: item_type.key})
|
23
|
+
.joins(item: :item_type).each do |inventory| %>
|
24
|
+
<div class="col-sm-6 col-lg-3">
|
25
|
+
<div class="block block-bordered block-link-hover3 text-center" href="javascript:void(0)">
|
26
|
+
<div class="block-content block-content-full bg-gray-lighter border-black-op" style="min-height: 75px;max-height:
|
27
|
+
50px" data-toggle="popover" title="" data-placement="top" data-content="<%= inventory.item.description %>" type="button" data-original-title="<%= inventory.item.name %>">
|
28
|
+
<div class="h5 font-w700"><%= image_tag inventory.item.image.icon32 %></div>
|
29
|
+
|
30
|
+
|
31
|
+
<div class="h7 text-muted text-uppercase push-5-t"></div>
|
32
|
+
</div>
|
33
|
+
<div class="block-content block-content-full block-content-xs " style="text-align: center;vertical-align: middle;min-height: 50px;max-height:50px">
|
34
|
+
<% if inventory.equipped %>
|
35
|
+
<button class="btn btn-xs btn-info push-5-r push-10" type="button">Equipado</button>
|
36
|
+
<% else %>
|
37
|
+
<%= link_to gamification_inventory_path(inventory, gamification_item_id: inventory.gamification_item_id,
|
38
|
+
user_id: @user.id, :equipped => true), :remote => true,
|
39
|
+
:method => :put, class: 'btn btn-success btn-xs',:data => { :disable_with => "<i class='fa fa-cogs' aria-hidden='true'></i>Equipando".html_safe } do %>
|
40
|
+
<i class="fa fa-check-square ">Equipar </i>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<% end %>
|
49
|
+
<% end %>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Gamification Inventories</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>User</th>
|
9
|
+
<th>Item</th>
|
10
|
+
<th>Equipped</th>
|
11
|
+
<th colspan="3"></th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
|
15
|
+
<tbody>
|
16
|
+
<% @gamification_inventories.each do |gamification_inventory| %>
|
17
|
+
<tr>
|
18
|
+
<td><%= gamification_inventory.User %></td>
|
19
|
+
<td><%= gamification_inventory.Item %></td>
|
20
|
+
<td><%= gamification_inventory.equipped %></td>
|
21
|
+
<td><%= link_to 'Show', gamification_inventory %></td>
|
22
|
+
<td><%= link_to 'Edit', edit_gamification_inventory_path(gamification_inventory) %></td>
|
23
|
+
<td><%= link_to 'Destroy', gamification_inventory, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<br>
|
30
|
+
|
31
|
+
<%= link_to 'New Gamification Inventory', new_gamification_inventory_path %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>User:</strong>
|
5
|
+
<%= @gamification_inventory.User %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Item:</strong>
|
10
|
+
<%= @gamification_inventory.Item %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Equipped:</strong>
|
15
|
+
<%= @gamification_inventory.equipped %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<%= link_to 'Edit', edit_gamification_inventory_path(@gamification_inventory) %> |
|
19
|
+
<%= link_to 'Back', gamification_inventories_path %>
|