(Advanced) Web Application Development

Slides:



Advertisements
Similar presentations
Bruce Scharlau, University of Aberdeen, 2008 RESTful Assessments.
Advertisements

(Advanced) Web Application Development Test Driven Development with Ruby and Rails Bruce Scharlau, University of Aberdeen, 2013.
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
UNIT-V The MVC architecture and Struts Framework.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
ZFApp Preview Walkthrough. What is ZFApp? ZFApp is an application framework built on top of Zend Framework Fully compatible with the latest ZF Versions.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Web Application Introducing Visual Web Developer 2008 Express and the.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
1 Chapter 2 & Chapter 4 §Browsers. 2 Terms §Software §Program §Application.
James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario.
Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Introduction  “M” “V” “C” stands for “MODEL” “VIEW” “CONTROLLER”. ASP.NET MVC is an architecture to develop ASP.NET web applications in a different manner.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
Ruby on Rails. Web Framework for Ruby Designed to make it easier to develop, deploy, and maintain web applications Design with Model-View-Controller –almost.
Leveraging SharePoint Search In SharePoint 2013 Jameson Bozeman.
ASP – Web Programming Class  Ravi Anand. ASP – Active Server Pages What is ASP? - Microsoft Technology - Can Run using IIS/PWS/Others - Helps us create.
1 Using MVC 6. MVC vs. ASP Web Forms Both run under ASP.NET Can coexist In Web Forms, browser requests page. xxx.aspx and xxx.aspx.cs on the server Page.
National College of Science & Information Technology.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Jim Fawcett CSE686 – Internet Programming Spring 2014
Class03 Introduction to Web Development (Hierarchy and the IDE)
Android Application Web 1.
An introduction to ASP.Net with MVC Nischal S
Introduction to gathering and analyzing data via APIs Gus Cavanaugh
Creating an XSLT Style Sheet for Formatting Data
Web Basics: HTML and HTTP
Jim Fawcett CSE686 – Internet Programming Spring 2012
Social Media And Global Computing Introduction to The MVC Pattern
Active Server Pages Computer Science 40S.
Introduction to Web Development (Part 2)
1993 version of Mosaic browser.
Data Virtualization Tutorial… CORS and CIS
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Play Framework: Introduction
Model View Controller
AVOIR -African virtual
Getting web pages First we need to get the webpage by issuing a HTTP request. The best option for this is the requests library that comes with Anaconda:
SharePoint Cloud hosted Apps
MVC Framework, in general.
Bruce Scharlau, University of Aberdeen, 2017
Unit 27 - Web Server Scripting
Ruby on Rails by Manik Juneja
Ruby on Rails by Manik Juneja
Controllers.
Chapter 15 Introduction to Rails.
Web Development & Design Foundations with H T M L 5
JavaScript.
Secure Web Programming
Web Development Using ASP .NET
Kevin Harville Source: Webmaster in a Nutshell, O'Rielly Books
HyperText Markup Language
An Introduction to JavaScript
BOF #1 – Fundamentals of the Web
PHP Forms and Databases.
Traditional Internet Applications
Introduction to AJAX and JSON
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Unit 4 The Web Book Test.
Chengyu Sun California State University, Los Angeles
ASSETS, SNIPPETS & COMPONENTS
Presentation transcript:

(Advanced) Web Application Development Views in Rails Applications Bruce Scharlau, University of Aberdeen, 2017

Discuss what you know about views with person next to you Bruce Scharlau, University of Aberdeen, 2017

Bruce Scharlau, University of Aberdeen, 2017 MVC is a design pattern Model represents the data in the program and business logic View (templates) manages the visual display of the data (Presentation Logic) Controller provides the means for user interaction with the data (application logic) Model View Controller Bruce Scharlau, University of Aberdeen, 2017

A Rails request uses MVC Browser Model Controller View The browser sends a request for a page to the controller on the server. The controller retrieves the data it needs from the model in order to respond to the request. The controller renders the data and sends it to the view. The view sends the page back to the client for the browser to display. Bruce Scharlau, University of Aberdeen, 2017

Keep domain logic out of views The view is there to support the presentation of the model. Any Ruby code should be in the model, a helper, or in the controller. Bruce Scharlau, University of Aberdeen, 2017

Views are generated for models Show.html.erb displays a single recipe Bruce Scharlau, University of Aberdeen, 2017

Views are generated for models _form.html.erb is for ‘new’ and ‘edit’ recipe files For loop gathers each attribute value of model Bruce Scharlau, University of Aberdeen, 2017

Views are generated for models index.html.erb is all recipe items For loop goes through each item in array Bruce Scharlau, University of Aberdeen, 2017

Explore Views built-in helpers <%= text_area_tag(:message, "Hi, nice site", size: "24x6") %> <%= password_field_tag(:password) %> <%= hidden_field_tag(:parent_id, "5") %> <%= search_field(:user, :name) %> <%= telephone_field(:user, :phone) %> <%= date_field(:user, :born_on) %> <%= datetime_local_field(:user, :graduation_day) %> <%= month_field(:user, :birthday_month) %> <%= week_field(:user, :birthday_week) %> <%= url_field(:user, :homepage) %> <%= email_field(:user, :address) %> <%= color_field(:user, :favorite_color) %> <%= time_field(:task, :started_at) %> <%= number_field(:product, :price, in: 1.0..20.0, step: 0.5) %> <%= range_field(:product, :discount, in: 1..100) %> http://guides.rubyonrails.org/form_helpers.html Bruce Scharlau, University of Aberdeen, 2017

Form_for binds form to object http://guides.rubyonrails.org/form_helpers.html Bruce Scharlau, University of Aberdeen, 2017

Use ‘form_tag’ for regular forms This is not tied to a model, so can gather data as required. Bruce Scharlau, University of Aberdeen, 2017

Parameters are passed as array Bruce Scharlau, University of Aberdeen, 2017

Use drop-down lists, etc as needed We covered these in early practical sessions Collection_select Collection_radio_buttons http://homepages.abdn.ac.uk/b.scharlau/pages/teaching/CS5550/practicals/practical-2-rails-start-travelagent.shtml Bruce Scharlau, University of Aberdeen, 2017

Rails API pages offer options Use API to find more options and details about how to use views http://api.rubyonrails.org Bruce Scharlau, University of Aberdeen, 2017

Layouts are to be rendered You can render the expected view by default. You can also change the rendered view. Instead of ‘show’ you could use ‘edit’ or something else as required. Bruce Scharlau, University of Aberdeen, 2017

Render only headers if required Pick option as needed to display result http://guides.rubyonrails.org/layouts_and_rendering.html Bruce Scharlau, University of Aberdeen, 2017

Render format as needed You don’t have to return HTML. render xml: @product render json: @product render html: "<strong>Not Found</strong>".html_safe render plain: “ok” render body: “raw” When and why would you use these? Bruce Scharlau, University of Aberdeen, 2017

Discuss two key points about views with person next to you Bruce Scharlau, University of Aberdeen, 2017