Subversion Repositories SmartDukaan

Rev

Rev 34023 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34023 Rev 34070
Line 47... Line 47...
47
            <td>
47
            <td>
48
                <button class="btn btn-danger removeExisting"><i class="fa fa-times"></i></button>
48
                <button class="btn btn-danger removeExisting"><i class="fa fa-times"></i></button>
49
            </td>
49
            </td>
50
        </tr>
50
        </tr>
51
        #end
51
        #end
52
    #else
-
 
53
        <tr>
-
 
54
            <td>
-
 
55
                <div class="form-group">
-
 
56
                    <select class="form-control select2 catalog_id" id="catalog_id">
-
 
57
                        <option value="">-- Select Catalog --</option>
-
 
58
                        #foreach($row in $catalogs)
-
 
59
                            <option value="$row.getId()">$row.getDescription()</option>
-
 
60
                        #end
-
 
61
                    </select>
-
 
62
                </div>
-
 
63
            </td>
-
 
64
            <td>
-
 
65
                <div class="form-group">
-
 
66
                    <input id="variant_name" class="form-control variant_name" placeholder="Variant name">
-
 
67
                    <input type="hidden" id="mapping_id" value="0">
-
 
68
                </div>
-
 
69
            </td>
-
 
70
            <td>
-
 
71
                <button class="btn btn-primary removeExisting"><i class="fa fa-minus"></i></button>
-
 
72
            </td>
-
 
73
        </tr>
-
 
74
    #end
52
    #end
75
    </tbody>
53
    </tbody>
76
</table>
54
</table>
77
 
-
 
78
<script>
-
 
79
    $(document).ready(function (){
-
 
80
        $('.selectOrCreate').select2({
-
 
81
            placeholder: "Select or add new",
-
 
82
            tags: true,
-
 
83
            createTag: function(params) {
-
 
84
                return {
-
 
85
                    id: params.term,
-
 
86
                    text: params.term,
-
 
87
                    newOption: true
-
 
88
                };
-
 
89
            },
-
 
90
            templateResult: function(data) {
-
 
91
                return data.newOption ? $('<span class="new-option">Add: ' + data.text + '</span>') : data.text;
-
 
92
            },
-
 
93
        });
-
 
94
    });
-
 
95
</script>
-
 
96
55