Subversion Repositories SmartDukaan

Rev

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

Rev 34859 Rev 34949
Line 104... Line 104...
104
                                <input type="hidden" id="bottomRightFile">
104
                                <input type="hidden" id="bottomRightFile">
105
                                <input id="bottomRightLink" class="form-control" placeholder="Redirection Link">
105
                                <input id="bottomRightLink" class="form-control" placeholder="Redirection Link">
106
                            </td>
106
                            </td>
107
                        </tr>
107
                        </tr>
108
                    </table>`;
108
                    </table>`;
-
 
109
doubleHero = `<table class="table table-bordered" id="doubleHero">
-
 
110
                <tr>
-
 
111
                    <td>
-
 
112
                        <img src="https://placehold.co/300x200" alt="Image" id="topLeftImage" width="300">
-
 
113
                        <input type="file" class="doubleLeftFile" style="display: none;">
-
 
114
                        <input type="hidden" id="doubleLeftFile">
-
 
115
                        <input id="doubleLeftLink" class="form-control" placeholder="Redirection Link">
-
 
116
                    </td>
-
 
117
                    <td>
-
 
118
                        <img src="https://placehold.co/300x200" alt="Image" id="bottomLeftImage" width="300">
-
 
119
                        <input type="file" class="doubleRightFile" style="display: none;">
-
 
120
                        <input type="hidden" id="doubleRightFile">
-
 
121
                        <input id="doubleRightLink" class="form-control" placeholder="Redirection Link">
-
 
122
                    </td>
-
 
123
                </tr>
-
 
124
            </table>`;
-
 
125
singleHero = `<table class="table table-bordered" id="singleHero">
-
 
126
                <tr>
-
 
127
                    <td>
-
 
128
                        <img src="https://placehold.co/600x300" alt="Image" id="topLeftImage" width="300">
-
 
129
                        <input type="file" class="singleFile" style="display: none;">
-
 
130
                        <input type="hidden" id="singleFile">
-
 
131
                        <input id="singleLink" class="form-control" placeholder="Redirection Link">
-
 
132
                    </td>
-
 
133
                </tr>
-
 
134
            </table>`;
109
function patchSectionData(sectionData) {
135
function patchSectionData(sectionData) {
110
    const container = $('.style-container');
136
    const container = $('.style-container');
111
    container.find('#heroFile').val(sectionData.hero.image.split('/').filter(Boolean).pop());
137
    container.find('#heroFile').val(sectionData.hero.image.split('/').filter(Boolean).pop());
112
    container.find('#heroLink').val(sectionData.hero.link);
138
    container.find('#heroLink').val(sectionData.hero.link);
113
    container.find('#heroImage').attr('src',sectionData.hero.image);
139
    container.find('#heroImage').attr('src',sectionData.hero.image);
Line 144... Line 170...
144
        $('#id').val(response.id);
170
        $('#id').val(response.id);
145
        $('#title').val(response.title);
171
        $('#title').val(response.title);
146
        $('#tabTitle').val(response.tabTitle);
172
        $('#tabTitle').val(response.tabTitle);
147
        $('#visible_on').val(response.visibleOn).trigger('change');
173
        $('#visible_on').val(response.visibleOn).trigger('change');
148
        $('#section_order').val(response.sectionOrder);
174
        $('#section_order').val(response.sectionOrder);
149
        $('#group').val(response.sectionGroup);
175
        $('#group').val(response.sectionGroup).trigger('change');
150
        $('#style').val(sectionData.style+'Hero').trigger('change');
176
        $('#style').val(sectionData.style+'Hero').trigger('change');
151
        $('#below').val(response.sectionBelow).trigger('change');
177
        $('#below').val(response.sectionBelow).trigger('change');
152
        $('#status').prop('checked', response.status);
178
        $('#status').prop('checked', response.status);
153
        patchSectionData(sectionData);
179
        patchSectionData(sectionData);
154
        $('#managePagesModal').modal('show');
180
        $('#managePagesModal').modal('show');
Line 197... Line 223...
197
            link: container.find('#topRightLink').val() || ''
223
            link: container.find('#topRightLink').val() || ''
198
        },
224
        },
199
        rightBottom: {
225
        rightBottom: {
200
            image: imgURL+container.find('#bottomRightFile').val() || '',
226
            image: imgURL+container.find('#bottomRightFile').val() || '',
201
            link: container.find('#bottomRightLink').val() || ''
227
            link: container.find('#bottomRightLink').val() || ''
-
 
228
        },
-
 
229
        doubleLeft: {
-
 
230
            image: imgURL+container.find('#doubleLeftFile').val() || '',
-
 
231
            link: container.find('#doubleLeftLink').val() || ''
-
 
232
        },
-
 
233
        doubleRight: {
-
 
234
            image: imgURL+container.find('#doubleRightFile').val() || '',
-
 
235
            link: container.find('#doubleRightLink').val() || ''
-
 
236
        },
-
 
237
        single: {
-
 
238
            image: imgURL+container.find('#singleFile').val() || '',
-
 
239
            link: container.find('#singleLink').val() || ''
202
        }
240
        }
203
    };
241
    };
204
 
242
 
205
 
243
 
206
    const params = {
244
    const params = {
Line 247... Line 285...
247
});
285
});
248
 
286
 
249
$(document).on('change', "#style", function() {
287
$(document).on('change', "#style", function() {
250
    var selectedStyle = $(this).val();
288
    var selectedStyle = $(this).val();
251
    $('.style-container').empty();
289
    $('.style-container').empty();
252
    if (selectedStyle == 'leftHero') $('.style-container').append(leftHero);
290
    if (selectedStyle === 'leftHero') $('.style-container').append(leftHero);
253
    if (selectedStyle == 'rightHero') $('.style-container').append(rightHero);
291
    if (selectedStyle === 'rightHero') $('.style-container').append(rightHero);
254
    if (selectedStyle == 'centerHero') $('.style-container').append(centerHero);
292
    if (selectedStyle === 'centerHero') $('.style-container').append(centerHero);
-
 
293
    if (selectedStyle === 'doubleHero') $('.style-container').append(doubleHero);
-
 
294
    if (selectedStyle === 'singleHero') $('.style-container').append(singleHero);
255
});
295
});
256
 
296
 
257
$(document).on('click', '.style-container img', function () {
297
$(document).on('click', '.style-container img', function () {
258
    const container = $(this).closest('td');
298
    const container = $(this).closest('td');
259
    const fileInput = container.find('input[type="file"]');
299
    const fileInput = container.find('input[type="file"]');