Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Fix: Use alternative syntax in view scripts #384

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions module/User/view/scn-social-auth/user/login.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
<p>
There is no sign-up form anymore! Just log in with your GitHub account. All your information will be provided by GitHub.
</p>
<?php
$socialSignIn = true;
foreach ($this->options->getEnabledProviders() as $provider) {
if ($socialSignIn) {
$socialSignIn = false;
}
echo '<p>' . $this->socialSignInButton($provider) . '</p>';
}
?>
<?php foreach ($this->options->getEnabledProviders() as $provider): ?>
<p><?php echo $this->socialSignInButton($provider); ?></p>
<?php endforeach; ?>
</div>
49 changes: 19 additions & 30 deletions module/User/view/zfc-user/user/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
</div>
<?php foreach ($this->flashMessenger()->getMessages() as $message): ?>
<h3 class="zf-green"><?php echo $message ?></h3>
<h3 class="zf-green"><?php echo $this->escapeHtml($message); ?></h3>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius

Escaping for now, would like to re-iterate on this and use the FlashMessenger directly, as suggested!
Also, I would like to use http://getbootstrap.com/components/#alerts, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done in a different MR then (with screenshots 'n stuff, so someone with better taste than me can deal with it :-) )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like to do this if @localheinz agrees - as i allready implemented this on a diff project (personal) 😼 :

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ins0

Sure, go ahead!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ins0

If you do, please have a look at places where classes are missing:

<div class="alert alert-block">No modules found</div>

which results in

screen shot 2015-02-17 at 16 16 38

vs.

<div class="alert alert-info alert-block">No modules found</div>

which would result in

screen shot 2015-02-17 at 16 16 56

💡 Just as an idea, in Getting Real from 37signals, there's a chapter The Blank State - I think we could improve on that.

<?php endforeach; ?>

<ul class="nav nav-tabs">
Expand All @@ -22,50 +22,39 @@
<br />
<div class="tab-content">
<div class="tab-pane active" id="modules">
<?php
if (empty($modules)) {
<?php if (0 === count($modules)): ?>
<div class="alert alert-block">No modules have been submitted yet</div>
<?php else: ?>
<?php foreach ($modules as $module): ?>
<?php echo $this->moduleView([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this helper require so many parameters? Isn't it easier to pass in $module instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius

That's what I plan to resolve next! 😉

'owner' => $module->getOwner(),
'name' => $module->getName(),
'created_at' => $module->getCreatedAt(),
'url' => $module->getUrl(),
'photo_url' => $module->getPhotoUrl(),
'description' => $module->getDescription(),
], 'remove');
?>
<div class="alert alert-block">No modules have been submitted yet</div>
<?php
}
/* @var ZfModule\Entity\Module[] $modules */
foreach ($modules as $module) {
echo $this->moduleView([
'owner' => $module->getOwner(),
'name' => $module->getName(),
'created_at' => $module->getCreatedAt(),
'url' => $module->getUrl(),
'photo_url' => $module->getPhotoUrl(),
'description' => $module->getDescription(),
], 'remove');
}
?>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="tab-pane" id="repositories">
<div class="well" style="text-align:center">Synchronizing with GitHub <img src="<?php echo $this->basePath('/img/ajax-loader.gif') ?>" alt="loading" /></div>
<div class="well" style="text-align:center">Synchronizing with GitHub <img src="<?php echo $this->basePath('/img/ajax-loader.gif'); ?>" alt="loading" /></div>
</div>

<div class="tab-pane" id="organizations">
<?php echo $this->userOrganizations() ?>
<?php echo $this->userOrganizations(); ?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="sidebar" style="text-align: center">
<h3 style="text-align:center">Hello, <?php echo $this->zfcUserDisplayName() ?>!</h3>
<h3 style="text-align:center">Hello, <?php echo $this->zfcUserDisplayName(); ?>!</h3>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't know but is this output safe or need escaped?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd escape it, but probably out of the scope of this PR. However, will fix it right away! 😉

<?php /* @var User\Entity\User $identity */ ?>
<?php $identity = $this->zfcUserIdentity(); ?>
<img class="thumbnail" src="<?php echo $identity->getPhotoUrl(); ?>" alt="<?php echo $this->zfcUserDisplayName() ?>"/>
<br/>
</div>
</div>
</div>

<?php
$url = $this->url('zf-module');
$this->inlineScript()->appendScript(<<<EOT
$("#repositories").load("$url");
EOT
);
<?php $this->inlineScript()->appendScript('$("#repositories").load("' . $this->escapeJs($this->url('zf-module')) . '");'); ?>