1 | # Template management |
||
2 | 1 | def get_center(template) # Responsive main method (12 units) |
|
3 | col = 12 # Main div, for all the width |
||
4 | col -= 3 unless template['right'].nil? # has right div |
||
5 | col -= 3 unless template['left'].nil? # has left div |
||
6 | "#{col}u important(collapse)" # return total units |
||
7 | end |
||
8 | |||
9 | 1 | def get_title(params) # Will set website title (top left corner) |
|
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
10 | vista = params[:view] ||= 'Herosheet' |
||
11 | title ||= vista.capitalize |
||
12 | title = params[:param].capitalize if title == 'view' |
||
13 | if (vista == 'historia' || vista == 'hero') |
||
14 | title = hero(params[:param].to_i).name |
||
15 | end |
||
16 | if vista == 'runa' |
||
17 | title = runa(params['param'].to_i).name.upcase |
||
18 | end |
||
19 | title.gsub!('Beastslord','Señor de las Bestias') |
||
20 | end |
||
21 | |||
22 | # DB Loader |
||
23 | 1 | def views |
|
24 | load_yaml('views') |
||
25 | end |
||
26 | |||
27 | # Helpers |
||
28 | 1 | def view(ruta) |
|
29 | views.find { |v| v['ruta'] == ruta } |
||
30 | end |
||
31 | |||
32 | 1 | def preview(ruta) |
|
33 | erb :template, locals: view(ruta) |
||
34 | end |
||
35 | |||
36 | 1 | def load_partial(position) |
|
37 | partial = position.gsub(':param', params[:param].to_s) |
||
38 | erb :"#{partial}" |
||
39 | end |
||
40 |