hugodias / FileUpload

Jquery File Upload for CakePHP 2.x
68 stars 25 forks source link

Responsive design #7

Closed cloudratha closed 11 years ago

cloudratha commented 11 years ago

Not sure if this is the right place to leave this.

I editted the UploadFormHelper so that it would be more responsive and act more like Blueimp's design. The reason was that with Bootstrap enabled, the item table would extend past my mobile screen. The progress bar was also either very small or non-existant.

Here is the updated code:

    private function _loadScripts()
{
    echo '<script id="template-upload" type="text/x-tmpl">
    {% for (var i=0, file; file=o.files[i]; i++) { %}
        <tr class="template-upload fade">
            <td class="preview"><span class="fade"></span></td>
            <td>
            <div class="name"><span>{%=file.name%}</span></div>
            <div class="size"><span>{%=o.formatFileSize(file.size)%}</span></div>
            {% if (file.error) { %}
                <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
            {% } else if (o.files.valid && !i) { %}
                <div>
                    <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
                </div>
                </td>
                <td>
                <div class="start">{% if (!o.options.autoUpload) { %}
                    <button class="btn btn-primary">
                        <i class="icon-upload icon-white"></i>
                        <span>{%=locale.fileupload.start%}</span>
                    </button>
                {% } %}</div>
            {% } else { %}
                <td colspan="2"></td>
            {% } %}
            <div class="cancel">{% if (!i) { %}
                <button class="btn btn-warning">
                    <i class="icon-ban-circle icon-white"></i>
                    <span>{%=locale.fileupload.cancel%}</span>
                </button>
            {% } %}</div>
            </td>
        </tr>
    {% } %}
    </script>

Basically changed the td to div and removed some code. Scales perfectly now.

hugodias commented 11 years ago

Hey @cloudratha great improvement! Can you submit a pull-request with this changes ?

cloudratha commented 11 years ago

I would love to but have no idea how github works. :dancer:

hugodias commented 11 years ago

Haha you may want to read this: http://git-scm.com/book/en/Getting-Started . Github it's just a visual approach of git.