Browse Source

Card size options UI

crobi 10 years ago
parent
commit
a6f2560804
3 changed files with 69 additions and 4 deletions
  1. 21
    4
      generator/css/card-size.css
  2. 35
    0
      generator/generate.html
  3. 13
    0
      generator/js/ui.js

+ 21
- 4
generator/css/card-size.css View File

31
 
31
 
32
 /* A4 paper area (minus epsilon for rounding) */
32
 /* A4 paper area (minus epsilon for rounding) */
33
 page[size="A4"] {
33
 page[size="A4"] {
34
-    width:  209.5mm; /* full: 210.0mm */
35
-    height: 296.5mm; /* full: 297.0mm */
34
+    width:  209mm; /* full: 210.0mm */
35
+    height: 295mm; /* full: 297.0mm */
36
 }
36
 }
37
 
37
 
38
 /* US letter area (minus epsilon for rounding) */
38
 /* US letter area (minus epsilon for rounding) */
39
 page[size="Letter"] {
39
 page[size="Letter"] {
40
-    width:  215.4mm; /* full: 215.9mm (8.5in) */
41
-    height: 278.9mm; /* full: 279.4mm (11.0in) */
40
+    width:  215mm; /* full: 215.9mm (8.5in) */
41
+    height: 278mm; /* full: 279.4mm (11.0in) */
42
 }
42
 }
43
 
43
 
44
 /* Default card size */
44
 /* Default card size */
48
     height:3.5in;
48
     height:3.5in;
49
 }
49
 }
50
 
50
 
51
+/* Bridge card size */
52
+.card-size-225x35 {
53
+    width:2.25in;
54
+    min-width:2.25in;
55
+    height:3.5in;
56
+}
57
+
51
 /* Poker / Magic card size */
58
 /* Poker / Magic card size */
52
 .card-size-25x35 {
59
 .card-size-25x35 {
53
     width:2.5in;
60
     width:2.5in;
67
     width:7.5in;
74
     width:7.5in;
68
     min-width:7.5in;
75
     min-width:7.5in;
69
     height:5.0in;
76
     height:5.0in;
77
+}
78
+
79
+.page[size="A4"] .card-size-full3x3 {
80
+    width:69mm;
81
+    height:98mm;
82
+}
83
+
84
+.page[size="Letter"] .card-size-full3x3 {
85
+    width:71mm;
86
+    height:92mm;
70
 }
87
 }

+ 35
- 0
generator/generate.html View File

82
                     </div>
82
                     </div>
83
                     <span class="help-block">Generated cards open in a new tab or window.</span>
83
                     <span class="help-block">Generated cards open in a new tab or window.</span>
84
                 </form>
84
                 </form>
85
+                <h3>Sizes</h3>
86
+                <form role="form" class="form-horizontal">
87
+                    <div class="form-group">
88
+                        <label for="page-size" class="col-sm-4 control-label">Page</label>
89
+                        <div class="col-sm-8">
90
+                            <select class="form-control" id="page-size" data-option="page_size">
91
+                                <option value="A4" selected>A4</option>
92
+                                <option value="Letter">US letter</option>
93
+                            </select>
94
+                        </div>
95
+                    </div>
96
+                    <div class="form-group">
97
+                        <label for="card-size" class="col-sm-4 control-label">Card</label>
98
+                        <div class="col-sm-8">
99
+                            <select class="form-control" id="card-size" data-option="card_size">
100
+                                <option value="225x35">2.25&quot; x 3.5&quot; (Bridge)</option>
101
+                                <option value="25x35" selected>2.5&quot; x 3.5&quot; (Poker)</option>
102
+                                <option value="35x50">3.5&quot; x 5.0&quot;</option>
103
+                                <option value="75x50">7.5&quot; x 5.0&quot;</option>
104
+                            </select>
105
+                        </div>
106
+                    </div>
107
+                    <div class="form-group">
108
+                        <label for="card-size" class="col-sm-4 control-label">Cards/page</label>
109
+                        <div class="col-sm-3">
110
+                            <input type="text" id="page-rows" class="form-control" data-option="page_rows" value="3">
111
+                        </div>
112
+                        <div class="col-sm-2">
113
+                            <p class="form-control-static">x</p>
114
+                        </div>
115
+                        <div class="col-sm-3">
116
+                            <input type="text" id="page-columns" class="form-control" data-option="page_columns" value="3">
117
+                        </div>
118
+                    </div>
119
+                </form>
85
                 <h3>Default values</h3>
120
                 <h3>Default values</h3>
86
                 <form role="form" class="form-horizontal">
121
                 <form role="form" class="form-horizontal">
87
                     <div class="form-group">
122
                     <div class="form-group">

+ 13
- 0
generator/js/ui.js View File

209
     ui_render_selected_card();
209
     ui_render_selected_card();
210
 }
210
 }
211
 
211
 
212
+function ui_change_option() {
213
+    var property = $(this).attr("data-option");
214
+    var value = $(this).val();
215
+    card_options[property] = value;
216
+    ui_render_selected_card();
217
+
218
+}
219
+
212
 function ui_change_card_title() {
220
 function ui_change_card_title() {
213
     var title = $("#card-title").val();
221
     var title = $("#card-title").val();
214
     var card = ui_selected_card();
222
     var card = ui_selected_card();
366
     $("#card-color").change(ui_change_card_color);
374
     $("#card-color").change(ui_change_card_color);
367
     $("#card-contents").change(ui_change_card_contents);
375
     $("#card-contents").change(ui_change_card_contents);
368
 
376
 
377
+    $("#page-size").change(ui_change_option);
378
+    $("#page-rows").change(ui_change_option);
379
+    $("#page-columns").change(ui_change_option);
380
+    $("#card-size").change(ui_change_option);
381
+
369
     $("#default-color").change(ui_change_default_color);
382
     $("#default-color").change(ui_change_default_color);
370
     $("#default-icon").change(ui_change_default_icon);
383
     $("#default-icon").change(ui_change_default_icon);
371
     $("#default-title-size").change(ui_change_default_title_size);
384
     $("#default-title-size").change(ui_change_default_title_size);

Loading…
Cancel
Save