Optimalization: simplified selectors
Squash
This commit is contained in:
parent
dd8ab7c001
commit
01c54d4d83
16 changed files with 34 additions and 24 deletions
|
@ -83,8 +83,8 @@ $(function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('form[data-confirm-text]').submit(confirmEvent);
|
$('form.confirmable').submit(confirmEvent);
|
||||||
$('a[data-confirm-text]').click(confirmEvent);
|
$('a.confirmable').click(confirmEvent);
|
||||||
|
|
||||||
|
|
||||||
//simple action buttons
|
//simple action buttons
|
||||||
|
@ -123,7 +123,7 @@ $(function()
|
||||||
|
|
||||||
|
|
||||||
//attach data from submit buttons to forms before .submit() gets called
|
//attach data from submit buttons to forms before .submit() gets called
|
||||||
$(':submit').each(function()
|
$('.submit').each(function()
|
||||||
{
|
{
|
||||||
$(this).click(function()
|
$(this).click(function()
|
||||||
{
|
{
|
||||||
|
|
|
@ -511,7 +511,7 @@ class PostController
|
||||||
throw new SimpleException('Thumbnail file is not readable');
|
throw new SimpleException('Thumbnail file is not readable');
|
||||||
|
|
||||||
$this->context->layoutName = 'layout-file';
|
$this->context->layoutName = 'layout-file';
|
||||||
$this->context->transport->cacheDaysToLive = 30;
|
$this->context->transport->cacheDaysToLive = 365;
|
||||||
$this->context->transport->mimeType = 'image/jpeg';
|
$this->context->transport->mimeType = 'image/jpeg';
|
||||||
$this->context->transport->fileHash = 'thumb' . md5($name . filemtime($path));
|
$this->context->transport->fileHash = 'thumb' . md5($name . filemtime($path));
|
||||||
$this->context->transport->filePath = $path;
|
$this->context->transport->filePath = $path;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<button type="submit">Log in</button>
|
<button class="submit" type="submit">Log in</button>
|
||||||
|
|
||||||
<input type="hidden" name="remember" value="0"/>
|
<input type="hidden" name="remember" value="0"/>
|
||||||
<label>
|
<label>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::DeleteComment, PrivilegesHelper::getIdentitySubPrivilege($this->context->comment->commenter))): ?>
|
<?php if (PrivilegesHelper::confirm(Privilege::DeleteComment, PrivilegesHelper::getIdentitySubPrivilege($this->context->comment->commenter))): ?>
|
||||||
<span class="delete">
|
<span class="delete">
|
||||||
<a class="simple-action" href="<?php echo \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>" data-confirm-text="Are you sure you want to delete this comment?">
|
<a class="simple-action confirmable" href="<?php echo \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>" data-confirm-text="Are you sure you want to delete this comment?">
|
||||||
delete
|
delete
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -62,6 +62,6 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Submit</button>
|
<button class="submit" type="submit">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<div id="url-handler">
|
<div id="url-handler">
|
||||||
<div class="input-wrapper"><textarea placeholder="Paste some URLs here, one per line." name="urls"></textarea></div>
|
<div class="input-wrapper"><textarea placeholder="Paste some URLs here, one per line." name="urls"></textarea></div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit">Add</button>
|
<button class="submit" type="submit">Add</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="submit-wrapper">
|
<div class="submit-wrapper">
|
||||||
<button id="the-submit" type="submit">Submit</button>
|
<button id="the-submit" class="submit" type="submit">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -341,8 +341,8 @@
|
||||||
<input type="hidden" name="submit" value="1"/>
|
<input type="hidden" name="submit" value="1"/>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button name="sender" type="submit" value="preview">Preview</button>
|
<button name="sender" class="submit" type="submit" value="preview">Preview</button>
|
||||||
<button name="sender" type="submit" value="submit">Submit</button>
|
<button name="sender" class="submit" type="submit" value="submit">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
<?php foreach ($this->context->options as $option): ?>
|
<?php foreach ($this->context->options as $option): ?>
|
||||||
<li class="<?php echo $option['class']; if (isset($option['inactive'])) echo ' inactive' ?>">
|
<li class="<?php echo $option['class']; if (isset($option['inactive'])) echo ' inactive' ?>">
|
||||||
<?php
|
<?php
|
||||||
|
$class = [];
|
||||||
|
|
||||||
$attrs = [];
|
$attrs = [];
|
||||||
if (!empty($option['link']))
|
if (!empty($option['link']))
|
||||||
{
|
{
|
||||||
|
@ -14,14 +16,22 @@
|
||||||
elseif (!empty($option['simple-action']))
|
elseif (!empty($option['simple-action']))
|
||||||
{
|
{
|
||||||
$attrs['href'] = $option['simple-action'];
|
$attrs['href'] = $option['simple-action'];
|
||||||
$attrs['class'] = 'simple-action';
|
$class []= 'simple-action';
|
||||||
|
|
||||||
|
if (isset($option['data-confirm-text']))
|
||||||
|
{
|
||||||
|
$attrs['data-confirm-text'] = $option['data-confirm-text'];
|
||||||
|
$class []= 'confirmable';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($option['data-redirect-url']))
|
||||||
|
$attrs['data-redirect-url'] = $option['data-redirect-url'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$attrs['href'] = '#';
|
$attrs['href'] = '#';
|
||||||
|
|
||||||
foreach ($option as $key => $val)
|
if (!empty($class))
|
||||||
if (strpos($key, 'data-') === 0)
|
$attrs['class'] = join(' ', $class);
|
||||||
$attrs[$key] = $val;
|
|
||||||
|
|
||||||
TextHelper::openHtmlTag('a', $attrs);
|
TextHelper::openHtmlTag('a', $attrs);
|
||||||
echo $option['text'];
|
echo $option['text'];
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Tag!</button>
|
<button class="submit" type="submit">Tag!</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Merge!</button>
|
<button class="submit" type="submit">Merge!</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Rename!</button>
|
<button class="submit" type="submit">Rename!</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<form action="<?php echo \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>" method="post" class="delete aligned" autocomplete="off" data-confirm-text="Are you sure you want to delete your account?">
|
<form action="<?php echo \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>" method="post" class="delete aligned confirmable" autocomplete="off" data-confirm-text="Are you sure you want to delete your account?">
|
||||||
<?php if ($this->context->user->id == $this->context->transport->user->id): ?>
|
<?php if ($this->context->user->id == $this->context->transport->user->id): ?>
|
||||||
<div class="current-password">
|
<div class="current-password">
|
||||||
<label class="left" for="current-password">Current password:</label>
|
<label class="left" for="current-password">Current password:</label>
|
||||||
|
@ -12,6 +12,6 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Delete account</button>
|
<button class="submit" type="submit">Delete account</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -56,6 +56,6 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Submit</button>
|
<button class="submit" type="submit">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"></label>
|
<label class="left"></label>
|
||||||
<button type="submit">Register</button>
|
<button class="submit" type="submit">Register</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Continue</button>
|
<button class="submit" type="submit">Continue</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="left"> </label>
|
<label class="left"> </label>
|
||||||
<button type="submit">Update settings</button>
|
<button class="submit" type="submit">Update settings</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue