part.internalshare now is noscript-ready (as in: it does not require JS for main functionality, apart from submitting the form data)

master
Michał 'rysiek' Woźniak 2014-01-25 05:40:26 +01:00
parent 0abd7ea7f6
commit 2ec72feab9
3 changed files with 49 additions and 30 deletions

View File

@ -42,7 +42,7 @@
-moz-transition:max-height ease-out 1s/*, opacity ease-out 0.5s*/; /* BUG? animating/transitioning on opacity makes elemets move just a tiny bit for the duration of the transition; doesn't look good */
-webkit-transition:max-height ease-out 1s/*, opacity ease-out 0.5s*/;
transition:max-height ease-out 1s/*, opacity ease-out 0.5s*/;
opacity:0.3;
opacity:0.5;
}
/* a hidden control checkbox should be hidden */
.displayable-container > .displayable-control.hide {
@ -111,6 +111,7 @@
.shared-with-list .share-options {
display: inline-table;
text-align: left;
position:relative;
}
.shared-with-list .share-options .share-label {
margin-left:0.5em;
@ -122,7 +123,35 @@
.shared-with-list .edit-options {
text-align:right;
}
/* noscript fun! */
.shared-with-list .share-options .share-can-edit-checkbox {
display:block;
width:1px;
height:1px;
position:absolute;
top:0em;
left:0em;
}
.shared-with-list .share-options .share-can-edit-checkbox::before {
content:" ";
display:inline-block;
font-size:100%;
border:solid 0.15em black;
color:black;
width:0.6em;
height:0.6em;
line-height:0.6em;
border-radius:0.1em;
}
.shared-with-list .share-options .edit-options :checked ~ .share-can-edit-checkbox::before {
content:"✔";
}
.shared-with-list .share-options .share-can-edit-space {
display:inline-block;
width:1.5em;
height:1em;
}
/* end noscript fun */
.share-interface-container.internal-share::after {
width:75%;
height:0px;
@ -130,16 +159,4 @@
content:" ";
margin:0.2em auto 0.5em auto;
border-top:solid 1px #ddd;
}
/*::before {
content:"✔";
display:inline-block;
font-size:100%;
border:solid 0.15em black;
color:black;
width:0.6em;
height:0.6em;
line-height:0.6em;
border-radius:0.1em;
}*/
}

View File

@ -45,29 +45,36 @@
<div class="displayable-container share-options">
<!--
"can edit" checkbox
- if the item type allows for precise sharing settings (update, create, delete), just an info box, readonly/disabled
- if the item type allows only for editable/uneditable (actually, just update) setting, a valid checkbox
- if the item type allows for precise sharing settings (update, create, delete), setting/un-setting all three at the same time via JS (and reflecting their state)
- if the item type allows only for editable/uneditable (actually, just update) setting, the "update" checkbox
this is checked via $_['basic_edit_options'] flag (if set and true, only editable/uneditable setting available)
this checkbox is available only when JS is enabled
otherwise the noscript tag makes space for a CSS/HTML "checkbox" showing the state of the create/update/delete checkboxes
-->
<noscript class="share-can-edit-space"><!--</noscript>
<input type="checkbox" class="permissions"
<?php if(empty($_['basic_edit_options'])): ?>
name="edit" data-permissions="<?php p(OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE); ?>" <?php if ($sharee['permissions'] & (OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE ) ): ?> checked="checked"<?php endif; ?> disabled="disabled"
name="edit" data-permissions="<?php p(OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE); ?>" <?php if ($sharee['permissions'] & (OCP\PERMISSION_UPDATE | OCP\PERMISSION_CREATE | OCP\PERMISSION_DELETE ) ): ?> checked="checked"<?php endif; ?>
<?php else: ?>
name="update" data-permissions="<?php p(OCP\PERMISSION_UPDATE); ?>" <?php p(($sharee['permissions'] & OCP\PERMISSION_UPDATE?'checked="checked"':''))?> id="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"
name="update" data-permissions="<?php p(OCP\PERMISSION_UPDATE); ?>" <?php if ($sharee['permissions'] & OCP\PERMISSION_UPDATE): ?> checked="checked"<?php endif; ?> id="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"
<?php endif; ?>
/>
<noscript>--></noscript>
<!-- "can edit" displayable-control label -->
<label for="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><?php p($l->t('can edit')); ?><?php if(empty($_['basic_edit_options'])): ?><img class="svg" alt="access control" src="<?php p(OCP\Util::imagePath('core', 'actions/triangle-s.svg')); ?>"><?php endif; ?></label>
<!-- "can share" label and checkbox -->
<label class="share-label"><input type="checkbox" name="share" class="permissions" data-permissions="<?php p(OCP\PERMISSION_SHARE); ?>" <?php p(($sharee['permissions'] & OCP\PERMISSION_SHARE?'checked="checked"':''))?>><?php p($l->t('can share')); ?></label>
<label class="share-label"><input type="checkbox" name="share" class="permissions" data-permissions="<?php p(OCP\PERMISSION_SHARE); ?>" <?php if ($sharee['permissions'] & OCP\PERMISSION_SHARE): ?> checked="checked"<?php endif; ?>><?php p($l->t('can share')); ?></label>
<!-- if we only have basic edit options available, there is no need for the advanced edit options controls, right? display these only when not in basic edit options regime -->
<?php if(empty($_['basic_edit_options'])): ?>
<!-- edit options displayable control and displayable itself -->
<input type="checkbox" class="displayable-control hide" name="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>" id="share-can-edit-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"/>
<div class="displayable edit-options">
<label><input type="checkbox" name="create" class="permissions" data-permissions="<?php p(OCP\PERMISSION_CREATE); ?>" <?php p(($sharee['permissions'] & OCP\PERMISSION_CREATE?'checked="checked"':''))?>><?php p($l->t('create')); ?></label>
<label><input type="checkbox" name="update" class="permissions" data-permissions="<?php p(OCP\PERMISSION_UPDATE); ?>" <?php p(($sharee['permissions'] & OCP\PERMISSION_UPDATE?'checked="checked"':''))?>><?php p($l->t('update')); ?></label>
<label><input type="checkbox" name="delete" class="permissions" data-permissions="<?php p(OCP\PERMISSION_DELETE); ?>" <?php p(($sharee['permissions'] & OCP\PERMISSION_DELETE?'checked="checked"':''))?>><?php p($l->t('delete')); ?></label>
<input type="checkbox" name="create" class="permissions" data-permissions="<?php p(OCP\PERMISSION_CREATE); ?>" <?php if ($sharee['permissions'] & OCP\PERMISSION_CREATE): ?> checked="checked"<?php endif; ?> id="share-permissions-create-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><label for="share-permissions-create-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><?php p($l->t('create')); ?></label>
<input type="checkbox" name="update" class="permissions" data-permissions="<?php p(OCP\PERMISSION_UPDATE); ?>" <?php if ($sharee['permissions'] & OCP\PERMISSION_UPDATE): ?> checked="checked"<?php endif; ?> id="share-permissions-update-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><label for="share-permissions-update-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><?php p($l->t('update')); ?></label>
<input type="checkbox" name="delete" class="permissions" data-permissions="<?php p(OCP\PERMISSION_DELETE); ?>" <?php if ($sharee['permissions'] & OCP\PERMISSION_DELETE): ?> checked="checked"<?php endif; ?> id="share-permissions-delete-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><label for="share-permissions-delete-<?php p($_['item_type']); ?>-<?php p($_['item_id']); ?>-<?php p($i); ?>"><?php p($l->t('delete')); ?></label>
<!-- a CSS/HTML "checkbox" showing the state of the create/update/delete checkboxes -->
<noscript class="share-can-edit-checkbox"></noscript>
</div>
<?php endif; ?>
</div>

View File

@ -3,13 +3,6 @@
(c) 2014 Michał "rysiek" Woźniak <rysiek@hackerspace.pl>
Licensed under AGPL.
*/ ?>
<noscript><style>
/* if JS is disabled, .share-link-form-submit will be available,
hence .share-link-e-mail-send is un-needed*/
.share-link-e-mail-send {
display:none;
}
</style></noscript>
<div class="share-interface-container link-share displayable-container"
data-item-type="<?php p($_['item_type']); ?>"
data-item="<?php p($_['item_id']); ?>"
@ -44,7 +37,9 @@
<div class="e-mail-form-container">
<input class="share-link-e-mail-address" value="" placeholder="<?php p($l->t('Email link to person')) ?>" type="e-mail"/>
<!-- the send e-mail submit button (unneeded and invisible if JS is disabled) -->
<noscript><!--</noscript>
<input class="share-link-e-mail-send" type="submit" value="<?php p($l->t('Send')) ?>"/>
<noscript>--></noscript>
</div>
<!-- the submit button (unneeded and invisible if JS is enabled) -->
<noscript><input class="share-link-form-submit" type="submit" value="<?php p($l->t('Submit link-sharing settings')) ?>"/></noscript>