diff options
Diffstat (limited to 'views/default/forms')
-rw-r--r-- | views/default/forms/avatar/crop.php | 50 | ||||
-rw-r--r-- | views/default/forms/profile/fields/add.php | 4 | ||||
-rw-r--r-- | views/default/forms/widgets/save.php | 4 |
3 files changed, 9 insertions, 49 deletions
diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php index 1f39ff73c..f622fd60f 100644 --- a/views/default/forms/avatar/crop.php +++ b/views/default/forms/avatar/crop.php @@ -6,13 +6,17 @@ */ elgg_load_js('jquery.imgareaselect'); +elgg_load_js('elgg.avatar_cropper'); elgg_load_css('jquery.imgareaselect'); $master_image = $vars['entity']->getIconUrl('master'); ?> <div class="clearfix"> - <img id="user-avatar" class="mrl" src="<?php echo $master_image; ?>" alt="<?php echo elgg_echo('avatar'); ?>" /> + <img id="user-avatar-cropper" class="mrl" src="<?php echo $master_image; ?>" alt="<?php echo elgg_echo('avatar'); ?>" /> + <div id="user-avatar-preview-title"><label><?php echo elgg_echo('avatar:preview'); ?></label></div> + <div id="user-avatar-preview"><img src="<?php echo $master_image; ?>" /></div> + </div> <div class="elgg-foot"> <?php @@ -27,47 +31,3 @@ echo elgg_view('input/submit', array('value' => elgg_echo('avatar:create'))); ?> </div> -<!-- grab the required js for icon cropping --> -<?php //@todo JS 1.8: no ?> -<script type="text/javascript"> - - // display a preview of the users cropped section - function preview(img, selection) { - // catch for the first click on the image - if (selection.width == 0 || selection.height == 0) { - return; - } - - var origWidth = $("#user-avatar").width(); //get the width of the users master photo - var origHeight = $("#user-avatar").height(); //get the height of the users master photo - var scaleX = 100 / selection.width; - var scaleY = 100 / selection.height; - $('#user-avatar-preview > img').css({ - width: Math.round(scaleX * origWidth) + 'px', - height: Math.round(scaleY * origHeight) + 'px', - marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', - marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' - }); - } - - function selectChange(img, selection) { - // populate the form with the correct coordinates once a user has cropped their image - $('input[name=x1]').val(selection.x1); - $('input[name=x2]').val(selection.x2); - $('input[name=y1]').val(selection.y1); - $('input[name=y2]').val(selection.y2); - } - - $(document).ready(function() { - $('<div id="user-avatar-preview"><img src="<?php echo $master_image; ?>" /></div>').insertAfter($('#user-avatar')); - $('<div id="user-avatar-preview-title"><label><?php echo elgg_echo('avatar:preview'); ?></label></div>').insertBefore($('#user-avatar-preview')); - - // init the cropping - $('#user-avatar').imgAreaSelect({ - selectionOpacity: 0, - aspectRatio: '1:1', - onSelectEnd: selectChange, - onSelectChange: preview - }); - }); -</script> diff --git a/views/default/forms/profile/fields/add.php b/views/default/forms/profile/fields/add.php index bd58ae381..1ea9c57a9 100644 --- a/views/default/forms/profile/fields/add.php +++ b/views/default/forms/profile/fields/add.php @@ -20,8 +20,8 @@ $type_control = elgg_view('input/dropdown', array('name' => 'type', 'options_val $submit_control = elgg_view('input/submit', array('name' => elgg_echo('add'), 'value' => elgg_echo('add'))); $formbody = <<< END - <div class="elgg-foot">$label_text: $label_control - $type_text: $type_control + <div>$label_text: $label_control</div> + <div class="elgg-foot">$type_text: $type_control $submit_control</div> END; diff --git a/views/default/forms/widgets/save.php b/views/default/forms/widgets/save.php index 4ba911cb5..6959b2a82 100644 --- a/views/default/forms/widgets/save.php +++ b/views/default/forms/widgets/save.php @@ -14,7 +14,7 @@ $custom_form_section = elgg_view($edit_view, array('entity' => $widget)); $access = ''; if ($show_access) { - $access = elgg_view('input/access', array( + $access = elgg_echo('access') . ': ' . elgg_view('input/access', array( 'name' => 'params[access_id]', 'value' => $widget->access_id, )); @@ -38,4 +38,4 @@ $body = <<<___END </div> ___END; -echo $body;
\ No newline at end of file +echo $body; |