Leaderboard
Popular Content
Showing content with the highest reputation on 04/06/2015 in all areas
-
A friend of mine asked me to build a website for the dog training business she just started. She already had a graphic designer create a logo and a small print brochure and wanted a clean, simple website. www.hundeschule-grosse-freiheit.de is the result. The website is neither big nor fancy. But it has some nice details: Responsive, lazy loading images Almost all images (except the SVGs and the badge image in the footer) are maintained via the ProcessWire backend. Each image is rendered in eight different sizes – using respimage and lazysizes for frontend display. All images are created using the great ImageFocusArea module – something I wanted to be able to use in ProcessWire since I first worked with Drupal’s “ImageField Focus” module. Of course all images are minified using minimize.pw. Central asset management for images Because most of the decorative images are used on more than one page, it made sense to build a central image management – using a specific “settings” part of the page tree with one page per image. Images in sidebars or on the gallery page are chosen using page fields in combination with the Page List Image Label module: So an editor’s experience regarding the visual representation of the “linked” images is not so much different from working with default image fields. Consequent usage of a cookieless subdomain for static content. The cookieless subdomain specified in the AIOM+ module’s setting is also used to deliver images. Multi-language content. Nothing big, but my first ProcessWire site with more than one language. Of course it uses the Autodetect Language module for the homepage – as well as “hreflang” links in each page’s head to give Google as much language information as possible. Feedback and ratings The feedback page, which features quotes and pictures of happy clients, is populated semi-automatically. Feedback is collected using a Form Builder form on a secret page. After a training has ended the site owner sends an email to clients, thanking them for taking part and asking them for their feedback with a link to the secret form page. Clients can enter a quote, a 5-star rating and optionally an image – as well as their permission to use the quote and the image (necessary to avoid legal problems). This information is saved as a new unpublished page. After a new feedback entry page is published by the site owner, the new entry is displayed on the main feedback page. The pages used to save feedback entries feature multi-language fields. So it’s possible to present all testimonial quotes in both languages. The footer of each page features an aggregated 5-star rating, calculated from all single ratings displayed on the feedback page. Each individual feedback entry on the feedback page as well as the aggregated rating are formated using Schema.org markup. So it can be read and understood by Google and thus has the potential to be displayed as rich snippet on Google result pages. Oh by the way: The decision to use email links rather than a contact form was made by the site owner.6 points
-
Big update! Version 0.3.0 comes with: a new "NewCommand" provided by HariKT! Big thanks again. This contribution should lead to a better workflow with Wireshell since it opens up the possibility to install PW via command line in a convenient way A command for creating fields A command for assigning fields to existing templates A generic backup command (DB dump) Commands for en/disabling modules (downloading them via Wireshell is still on my bucket list) A little command outputting the currently installed ProcessWire version An unified approach to naming commands and classes: entity:verb, so for example user:create I dropped the "(Experimental)" from the topic's title Read more about the available new commands and their options in the readme. If you have an older version of Wireshell installed, make sure you "$ composer update" it in order to get the new dependencies. And we're on packagist now: https://packagist.org/packages/wireshell/wireshell6 points
-
Since I've been working on a few projects where I used Bootstrap 3 and will be using it for future projects, I put together a blank site profile with Bootstrap 3 Sass, Fontawesome and a few markup render functions for Bootstrap dropdown menu, image carousel and accordion. You can find it at https://github.com/gebeer/site-pwbs Features bootstrap-sass-official font-awesome SASS version jquery modernizr render functions for:BS3 dropdown menu BS3 accordion from PageArray BS3 carousel from PW images array Prerequisites compass bower How to install from zip: download the zip extract the folder "site-pwbs" into a clean ProcessWire install's root folder during install of ProcessWire choose the profile "bootstrap-sass-official fontawesome blank profile" After installation The last step after installing the profile is to install all assets with bower: open a terminal in site/templates and execute "bower install" How it works The profile is based on the blank site profile that comes with PW 2.5 and uses the delegate template approach. It comes with a top navbar, a main container and a footer section. Rest is up to you. CSS gets compiled through compass. You can easily override BS variables and exclude BS components that you don't need. I intentionally did not add structure to the sass folder so you can structure your partials yourself as you please. There is only one folder "generic" with _mixins.scss whith a very lean and flexible breakpoint mixin that I discovered here. JS Since I only use the BS javascript plugins I really need, I usually copy them over to my plugins.js file. I use bower to install bootstrap-sass-original and fontawesome because it gives more flexibility than requiring them through ruby gems. This way you can tweak the BS and FA partials to your liking (of course only if you don't intend to do "bower update" further down the road) Enjoy!4 points
-
Thanks. Your example didn't work as-is (determining if customrole is in the array), so I did some research and came up with this (makes use of jQuery in the CSS loading part): $(function () { var customrole = 'superuser', info = config.AdminCustomFiles; function getRole(){ var arr = info.roles; for(var j = 0; j<arr.length;j++ ){ if(arr[j] == customrole){ return true; } } } if (getRole() === true) { loadCSS = function(href) { var cssLink = $("<link rel='stylesheet' type='text/css' href='"+href+"'>"); $("head").append(cssLink); }; loadCSS("/site/templates/AdminCustomFiles/piilota-kielet.css"); } else { console.log("Don't do it!"); } }); CSS for hiding all but default language: .LanguageSupport { display: none; } .LanguageSupport:nth-of-type(1) { display: block; } Edit: switched from :first-child to :nth-of-type(1) so that we can see the Name field when adding a page. Edit 3 years later: the new version changed the JSON data, so info.user.roles is now simply info.roles3 points
-
The process is the process that is running. (Admin pages have this process assigned on the page) The roles are the roles the logged-in user has. Admin theme should not matter. // not tested, but should give a clue.... $(function () { var customrole = 'editor', info = config.AdminCustomFiles; if (info.user.roles[customrole].length) { $('#element').addClass('hide-me'); console.log('Do your stuff'); } else { console.log("Don't do it!"); } });3 points
-
Hi folks, thanks for all your replies. Here's how I did it. $(document).on('pjax:end', function() { var bodyClass = $('meta[name=body-class]').attr('content'); if (bodyClass !== undefined) { document.body.className = bodyClass; } }); Then on every template which would be within the ajax/pjax container: <meta name="body-class" content="<?php echo $page->name; ?>" /> Thanks, R2 points
-
Since Wireshell is on packagist now and "composer global require wireshell/wireshell" installs it into "~/.composer/vendor/bin/wireshell" on Linux, could you test/check what the comparable Windows path or workflow would be? I'm currently rewriting (simplifying) the installation guide. Cheers!2 points
-
I don’t use a framework. Instead I use my own collection of boilerplates, polyfills and tools I (re-)use in most of my sites: https://github.com/MichaelvanLaar/Website-Template-Starting-Point This starting point is still far away from being perfect. In fact, there are always things I want to change – right now it’s more BEM-ish CSS. But it serves its purpose.2 points
-
I'm interested learning more, do you have specs? Here's something I'm working on now, it showcases my skills w/ PW.1 point
-
I think it would be enough to have ProcessDrafts (containing all of the markup and logic that is needed to display the drafts page) and ProcessDraftsAutoload (containing all the autoload stuff and hooks)1 point
-
I will turn on debug mode and see if I can get any errors. (nothing is showing up in the log though). @Nico knolI: Thanks, I think the issue is I have one module that is doing 4-5 related things to drafting pages and publishing them, but those things should probably be split into separate modules. (I think) A process module that is not auto load (which I just learned from your post), and then several autoload modules need access to the runtime hooks (altering page listings, adding draft buttons, edit draft buttons, etc.)1 point
-
Latest update to my local testing branch... Moved totally from custom callbacks to PW hooks (core and module own hookable methods) Have a working minimal FrontendUserLogin and FrontendUserRegister module. Added FormHelper dependency again (instead of a extended wrapper FormHelper is changed to extend InputfieldForm object) FrontendUserLogin / FrontendUserRegister (simple use) // login echo $modules->get('FrontendUserLogin')->render($redirectAfterLogin); // register echo $modules->get('FrontendUserRegister')->render($redirectAfterRegister); The method render() is a shortcut. Long form with chance to modify parameters, form, ... $fu->form(); $fu->validate(); $fu->process($redirect); $fu->renderForm(); How to add plugins? After $fu->form() define the plugin field and needed processing validation code as a PW hook RememberMe plugin to integrate LoginPersist module // RememberMe field / persistLogin integration $remember = $modules->get('InputfieldCheckboxes'); $remember->name = 'persist'; $remember->attr('id+name', 'persist'); $remember->skipLabel = 4; $remember->addoption('persist', 'Remember me?'); $remember->addHookAfter('processInput', function($event) { $field = $event->object; if (isset($field->value[0]) && $field->value[0] === 'persist') { wire()->addHookAfter('Session::login', function($event) { wire('modules')->get('LoginPersist')->persist(); }); } }); $fu->attr('form')->add($remember); Or an integration of core module ProcessForgotPassword // ForgotPassword integration $forgot = $modules->get('InputfieldMarkup'); $forgot->value = "<a href='{$page->url}?forgot=1'>{$this->_('Forgot password?')}</a>"; $fu->attr('form')->add($forgot); if ($input->get->forgot) { function processForgot($event) { wire('config')->styles->add('/pw/wire/modules/AdminTheme/AdminThemeDefault/styles/main-classic.css'); $event->return = wire('modules')->get('ProcessForgotPassword')->execute(); $event->replace = true; } $fu->addHookBefore('FrontendUserLogin::login', null, 'processForgot'); } Login with email address instead of username? // Email login instead of username $fieldUser = $fu->attr('form')->get('username'); $fieldUser->addHookBefore('FrontendUserLogin::auth', function($event) { $fu = $event->object; $email = $fu->attr('form')->fhValue('username', 'email'); $loginUser = wire('users')->get("email={$email}"); if ($loginUser instanceof User && !$loginUser->isGuest()) { $event->arguments(0, $loginUser->name); } }); You have added a nickname field to user template? The plugin to use the nickname (sanitized text instead of username) to login // Nickname login instead of username $fieldUser = $fu->attr('form')->get('username'); $fieldUser->addHookBefore('FrontendUserLogin::auth', function($event) { $fu = $event->object; $nick = $fu->attr('form')->fhValue('username', 'text'); $loginUser = wire('users')->get("nickname={$nick}"); if ($loginUser instanceof User && !$loginUser->isGuest()) { $event->arguments(0, $loginUser->name); } }); The plugins are tested and working fine, but I don't know how to ship plugins. At the moment it's code inside the template login.php, but should be moved to a separate plugin file or the FrontendUserLogin module... Any suggestions? *Added nickname login plugin and fixed a nickname / email login bug*1 point
-
@Martijn Geerts THIS module is a really great one! Thank you very much - just experimented with it a little bit and result is: easy == awesome best regards mr-fan1 point
-
I'm very much in Joss' boat here - for me, PW is a true all-rounder, ready for anything. I stumbled upon PW a few years back when I was looking for a system that allowed me to seamlessly work with multiple content-types. This was my big issue in my search. I used WordPress for about a year. In that short time, I found myself judging it more often that I would judge anything. I say that without the intent of throwing flames. Since my career in web development began, I'd been looking for a great platform on which to do great things. As time went on, I found various different options - of course, like with most things, they all did at least one thing good to suit my needs. Problem was, it was only partial - no system before PW did what I wanted it to do the way I wanted it done, and in a seamless and effortless (no, I'm not lazy) manner. I had stumbled onto PW before - back in the 2.0 days, but I didn't like the interface, at all. I believe it was 2.4 that changed the interface (it's design; UI, specifically) - it was at that point that I fell for it. I'm now at the stage where I can't look back. PW does everything that needs to be done, and then some. And it does it in an elegant way. This is what I was searching for. WordPress didn't do that for me. Joomla didn't do that for me (granted - I didn't use Joomla for very long at all). Nor did Drupal. Granted, those are all beast systems - but they are advertised that way - in a way, that can make them quite scary. Bolt, a reasonably new system, did most of what I wanted, but it's very limited, and, as such, should probably only be used for small sites. PW is more of a beast than the big three above to me. The silent beast. I'm sure you all know what I mean. I'd also like to ask something: I see more and more, around the internet and mostly in forums, that developers seem to choose their CMS based on what CMS the client wants. I find that quite interesting, because I've never had that experience. I have small and medium sized businesses in my portfolio - a decent amount of them quite knowledgeable in the web development field - and none of them asked me to use a specific CMS. They all just say, "use what you wish, as long as it gets the job done." So I ask, is this common elsewhere in the world? And if so, how do you deal with it?1 point