crobi 10 年前
父节点
当前提交
e63bcedf44
共有 3 个文件被更改,包括 18 次插入3 次删除
  1. 7
    1
      generator/generate.html
  2. 10
    2
      generator/js/card.ts
  3. 1
    0
      generator/js/ui.ts

+ 7
- 1
generator/generate.html 查看文件

237
                         </div>
237
                         </div>
238
                     </div>
238
                     </div>
239
                     <div class="form-group">
239
                     <div class="form-group">
240
-                        <label for="card-title-size" class="col-sm-2 control-label">Title</label>
240
+                        <label for="card-title-size" class="col-sm-2 control-label">Title size</label>
241
                         <div class="col-sm-10">
241
                         <div class="col-sm-10">
242
                             <select class="form-control" id="card-title-size" data-property="title_size">
242
                             <select class="form-control" id="card-title-size" data-property="title_size">
243
                                 <option value="" selected>default font</option>
243
                                 <option value="" selected>default font</option>
251
                             </select>
251
                             </select>
252
                         </div>
252
                         </div>
253
                     </div>
253
                     </div>
254
+                    <div class="form-group">
255
+                        <label for="card-title-icon-text" class="col-sm-2 control-label">Icon text</label>
256
+                        <div class="col-sm-10">
257
+                            <input type="text" id="card-title-icon-text" class="form-control" placeholder="Icon text" data-property="title_icon_text">
258
+                        </div>
259
+                    </div>
254
                     <div class="form-group">
260
                     <div class="form-group">
255
                         <label for="card-count" class="col-sm-2 control-label">Count</label>
261
                         <label for="card-count" class="col-sm-2 control-label">Count</label>
256
                         <div class="col-sm-10">
262
                         <div class="col-sm-10">

+ 10
- 2
generator/js/card.ts 查看文件

44
         count: number;
44
         count: number;
45
         title: string;
45
         title: string;
46
         title_size: string;
46
         title_size: string;
47
+        title_icon_text: string;
47
         color: string;
48
         color: string;
48
         color_front: string;
49
         color_front: string;
49
         color_back: string;
50
         color_back: string;
59
             this.count = 1;
60
             this.count = 1;
60
             this.title = "New card";
61
             this.title = "New card";
61
             this.title_size = null;
62
             this.title_size = null;
63
+            this.title_icon_text = null;
62
             this.color = null;
64
             this.color = null;
63
             this.color_front = null;
65
             this.color_front = null;
64
             this.color_back = null;
66
             this.color_back = null;
75
             result.count = json.count || 1;
77
             result.count = json.count || 1;
76
             result.title = json.title || "";
78
             result.title = json.title || "";
77
             result.title_size = json.title_size || null;
79
             result.title_size = json.title_size || null;
80
+            result.title_icon_text = json.title_icon_text || null;
78
             result.color = json.color || null;
81
             result.color = json.color || null;
79
             result.color_front = json.color_front || null;
82
             result.color_front = json.color_front || null;
80
             result.color_back = json.color_back || null;
83
             result.color_back = json.color_back || null;
91
                 count: this.count,
94
                 count: this.count,
92
                 title: this.title,
95
                 title: this.title,
93
                 title_size: this.title_size,
96
                 title_size: this.title_size,
97
+                title_icon_text: this.title_icon_text,
94
                 color: this.color,
98
                 color: this.color,
95
                 color_front: this.color_front,
99
                 color_front: this.color_front,
96
                 color_back: this.color_back,
100
                 color_back: this.color_back,
132
         public getTitleSize(options: Options): string {
136
         public getTitleSize(options: Options): string {
133
             return this.title_size || options.default_title_size || "13";
137
             return this.title_size || options.default_title_size || "13";
134
         }
138
         }
139
+        public getTitleIconText(options: Options): string {
140
+            return this.title_icon_text || "";
141
+        }
135
         public getColorFront(options: Options): string {
142
         public getColorFront(options: Options): string {
136
             return this.color_front || this.color || options.default_color || "black";
143
             return this.color_front || this.color || options.default_color || "black";
137
         }
144
         }
347
 
354
 
348
         private  _title(card: Card, options: Options, ind: string, ind0: string): string {
355
         private  _title(card: Card, options: Options, ind: string, ind0: string): string {
349
             var title = card.getTitle(options);
356
             var title = card.getTitle(options);
350
-            var title_size = card.getTitleSize(options)
357
+            var title_size = card.getTitleSize(options);
358
+            var title_icon_text = card.getTitleIconText(options);
351
             var icon = card.getIconFront(options);
359
             var icon = card.getIconFront(options);
352
             var result = "";
360
             var result = "";
353
             result += ind + '<card-title size="' + title_size + '">\n';
361
             result += ind + '<card-title size="' + title_size + '">\n';
354
             result += ind + ind0 + '<h1>' + title + '</h1>\n';
362
             result += ind + ind0 + '<h1>' + title + '</h1>\n';
355
-            result += ind + ind0 + '<h2>' + "" + '</h2>\n';
363
+            result += ind + ind0 + '<h2>' + title_icon_text + '</h2>\n';
356
             result += this._icon(icon, ind + ind0, ind0);
364
             result += this._icon(icon, ind + ind0, ind0);
357
             result += ind + '</card-title>\n';
365
             result += ind + '</card-title>\n';
358
             return result;
366
             return result;

+ 1
- 0
generator/js/ui.ts 查看文件

494
 
494
 
495
         $("#card-title").change(on_change_card_title);
495
         $("#card-title").change(on_change_card_title);
496
         $("#card-title-size").change(on_change_card_property);
496
         $("#card-title-size").change(on_change_card_property);
497
+        $("#card-title-icon-text").change(on_change_card_property);
497
         $("#card-icon").change(on_change_card_property);
498
         $("#card-icon").change(on_change_card_property);
498
         $("#card-count").change(on_change_card_property);
499
         $("#card-count").change(on_change_card_property);
499
         $("#card-icon-back").change(on_change_card_property);
500
         $("#card-icon-back").change(on_change_card_property);

正在加载...
取消
保存