<div id="window_galleryIndex" class="page-window active-window">
  <input type="hidden" class="prev_window"/>
  <div class="page-title">
    <i class="icon-custom-left"></i>
      <h3><?php echo e(trans('resource.upload.title')); ?> - <span class="semi-bold"><?php echo e(trans('resource.upload.gallery')); ?></span></h3>
  </div>
  <div class="page-title">
    <div class="control-group">
      <label class="control-label"><?php echo e(trans('resource.upload.name')); ?></label>
      <div class="controls">
        <input class="span12 " type="text" name="superboxname">
        <input class="span12 " type="hidden" name="superboxnamehidden">
      </div>
    </div>
  </div>
  <div class="superbox" style="background: #fff;">
				<?php $__currentLoopData = $model; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
          <div class="superbox-list"><!--
          --><img img-name="<?php echo e($item->name); ?>" src="<?php echo e($item->path); ?>" data-img="<?php echo e($item->path); ?>" alt="" class="superbox-img" style="width: 160px; height:160px;"/>
          </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
				<div class="superbox-float"></div>
	</div>
  <div class="modal-footer">
    <button class="btn" onclick="uPage.close('window_galleryIndex', function(){})"><?php echo e(trans('resource.buttons.close')); ?></button>
    <?php if($backType == "summernote"): ?>
        <button class="btn btn-primary" onclick="uPage.close('window_galleryIndex', function(){ ugallery.setToSummerNote(); })"><?php echo e(trans('resource.buttons.choose')); ?></button>
      <?php else: ?>
        <button class="btn btn-primary" onclick="uPage.close('window_galleryIndex', function(){ ugallery.setToInput('<?php echo e($input); ?>'); })"><?php echo e(trans('resource.buttons.choose')); ?></button>
    <?php endif; ?>
  </div>



  <script type="text/javascript">
    $(document).ready(function(){
      $('.superbox').SuperBox();
      $('.superbox-img').click(function(){
          $('input[name="superboxname"]').val($(this).attr("img-name"));
          $('input[name="superboxnamehidden"]').val($(this).attr("data-img"));
      });
    });

    var ugallery = {
        setToInput: function(input){
            $("#" + input).val($('input[name="superboxnamehidden"]').val());
        },

        setToSummerNote: function(){
            selectedContext.invoke('insertImage', $('input[name="superboxnamehidden"]').val(), $('input[name="superboxname"]').val());
        }
    }
  </script>
</div>
