Wednesday, March 1, 2017

Alessandro Scarpellini

Beautifully minimal One Page portfolio redesign for Italian designer, Alessandro Scarpellini.

by Rob Hope via One Page Love

OneBigTweet

OneBigTweet

Parallax scrolling One Pager with slick load transitions for non-profit campaign #OneBigTweet.

by Rob Hope via One Page Love

This Week in Mobile Web Development (#147)

Read this on the Web

Mobile Web Weekly March 1, 2017   #147
Peter Cooper recommends
Progressive Web App Libraries in Production “In 2017, if you aren’t taking advantage of Service Workers, you’re leaving performance wins for returning users on the table.”
Addy Osmani
Holly Schinsky recommends
Touch Devices Should Not Be Judged By Their Size — Media queries aren’t always enough when designing for touch screens, but a new Interaction Media spec can help by detecting pointing device and hover capabilities.
Andres Galante
Brian Rinaldi recommends
Google's Accelerated Mobile Pages Now Accounts for 7% of Traffic to Big US Publishers — According to data released by Adobe Analytics, Accelerated Mobile Pages (AMP) now accounts for a significant and growing portion of traffic to major publishers.
Rich McCormick
Sponsored
Learn to develop your next web or mobile application with ReactJS — Register for Rangle’s free React online course for developers on March 31. The second of a three-part series, this course is designed for developers interested in diving into the React library.
Rangle.io

Holly Schinsky recommends
How to Build Your Own Progressive Image Loader — A handy technique for progressive image loading to provide the best performance in your hybrid mobile apps.
Craig Buckler
Brian Rinaldi recommends
Why I Love Element Queries and You Should Too — What makes element queries powerful and how you can get started using them with the EQCSS plugin.
Tommy Hodgins
Chris Brandrick recommends
Nokia’s 3310 Returns to Life As A Modern Classic — Basic web use is achieved via the bundled Opera Mini browser, running over a 2.5G connection.
Tom Warren
Peter Cooper recommends
How to Build an Ionic 2 App with Native Plugin Integrations
Coding Sans
Brian Rinaldi recommends
Great Alternatives to Hamburger Menus — How to make your navigation obvious and keep people engaged.
Mobiscroll
Chris Brandrick recommends
Sneak Preview of NativeScript 3.0 — Georgi Atanasov gives us a sneak preview of NativeScript 3.0, due out in mid-April.
NativeScript
Peter Cooper recommends
How to Make Your App a PWA
Mirosław Ciastek
Holly Schinsky recommends
Increasing Performance with Efficient DOM Writes in Ionic 2
Josh Morony
Brian Rinaldi recommends
Introduction to Ionic 2 — A look at what’s new and changed between Ionic 1 and 2 and whether you should choose Ionic 2 for your project.
Wernher-Bel Ancheta
Holly Schinsky recommends
Ionic Split Panel Component — An in-depth look at the split panel component recently released by Ionic.
Chris Griffith
Holly Schinsky recommends
How to Install 3rd Party Libraries in Ionic 2
Joshua Morony
Brian Rinaldi recommends
CSS Grid: Learning New Layout - Responsive — A quick comparison of the code necessary to create a grid with and without CSS Grid support.
Susan Robertson
Holly Schinsky recommends
A Roundup of Vue.js-Supporting Mobile Hybrid App Frameworks — A roundup of hybrid mobile frameworks supporting Vue.js 2.0.
Alligator.io
Holly Schinsky recommends
Testing on Multiple Form factors — Maya-kai mirrors gestures and user interactions in React Native applications, making it useful for testing apps on devices with different screen sizes at the same time.
Parashuram N
Peter Cooper recommends
Design a Perfect Search Box — How this element can be improved in order to save the user time in going where they want.
Nick Babich
Brian Rinaldi recommends
spacegrid: A Basic, Responsive Grid Layout
Jonathan Speek
Curated by Brian Rinaldi and Holly Schinsky for Cooperpress.
Cooperpress is located at Office 30, Fairfield Enterprise Centre, Louth, LN11 0LS, UK
Update your email address
or stop receiving MWW here


by via Mobile Web Weekly

Authorization With Pundit

Pundit is a tool that allows you to restrict certain parts of your Rails application to authorized users. It does this by providing you with certain helpers.

In this tutorial, you will build a blog that restricts parts such as creating, updating and deleting articles to authorized users only.

Getting Started

Start by generating a new Rails application.

The -T flag tells Rails to generate the new application without the default test suite. Running the command will generate your Rails application and install the default gems.

Go ahead and add the following gems to your Gemfile. You will be using bootstrap-sass for the layout of your application, and Devise will handle user authentication.

Run the command to install the gem.

Now rename app/assets/stylesheets/application.css to app/assets/stylesheets/application.scss. Add the following lines of code to import bootstrap.

Create a partial named _navigation.html.erb to hold your navigation code; the partial should be located in app/views/layouts directory. Make the partial look like what I have below.

For the navigation to be used, you need to render it in your application layout. Tweak your application layout to look like what I have below.

Generate the User Model

Run the command to install Devise.

Now generate your User model.

Migrate your database.

Generate Article Resources

Run the command to generate your Article resources.

This will generate your ArticlesController and Article Model. It will also generate the views needed.

Now migrate your database by running:

Open up app/views/articles/_form.html.erb and make it look like what I have below.

For your index file, it should look like this.

The above code arranges the articles on the index page into a table format to make it look presentable.

Open up your routes file and add the route for articles resources.

Integrate Pundit

Add the Pundit gem to your Gemfile.

Run the command to install.

Integrate Pundit to your application by adding the following line to your ApplicationController.

Run Pundit's generator.

This will generate an app/policies folder which contains a base class with policies. Each policy is a basic Ruby class.

This is how the base class policy looks.

Create the Article Policy

Now you need to write your own policy. For this tutorial, you want to allow only registered users to create new articles. In addition to that, only creators of an article should be able to edit and delete the article.

To achieve this, your article policy will look like this.

In the above, you are permitting everyone (registered and non-registered users) to see the index page. To create a new article, a user has to be registered. You use user.present? to find out if the user trying to perform the action is registered.

For updating and deleting, you want to make sure that only the user who created the article is able to perform these actions.

At this point, you need to establish a relationship between your Article and User model.

You do so by generating a new migration.

Next, migrate your database by running the command:

Open the User model and add the line that seals the relationship.

Your Article model should have this.

Now you need to update your ArticlesController so it is in sync with what you have done so far.

At this point in your application, you have successfully implemented the policies that restrict certain parts of your application to selected users.

You want to add a standard error message that shows whenever a non-authorized user tries to access a restricted page. To do so, add the following to your ApplicationController.

This code simply renders a basic text that tells the user s/he is not authorized to perform the action.

Run:

To start your Rails server, point your browser to http://localhost:3000 to see what you have.

Conclusion

In this tutorial, you learned how to work with both Devise and Pundit. You were able to create policies that allowed only authorized users to view certain parts of the application. You also created a basic error text that shows when a non-authorized user tries to access a restricted part of the application.

You can learn more about Pundit by checking the GitHub page.


by Kingsley Silas Chijioke via Envato Tuts+ Code

How to Add Video to Your Social Media Marketing

Want to add video to your social media marketing mix? Wondering how to get started? Understanding what types of video work best on each social network will help you create a well-organized video strategy. In this article, you’ll discover four tips for adding video to your social media marketing. #1: Produce the Right Video for [...]

This post How to Add Video to Your Social Media Marketing first appeared on .
- Your Guide to the Social Media Jungle


by Alex York via

Create

Create is an explorative movement within Bang & Olufsen on a quest to inspire and be inspired by the global creative community.
by via Awwwards - Sites of the day

Ransmeier Inc.

Ransmeier Inc.

Minimal One Pager for NY-based industrial design studio, Ransmeier Inc. Each project's text acts as a trigger to launch a unique "stacked" gallery of the images.

by Rob Hope via One Page Love