Mamili ka, code ko to:
*************************************************
class PagesController < ApplicationController
#layout false;
layout "admin"
before_action :confirm_logged_in
def index
@pages = Page.sorted
end
def show
page = Page.find(params[:id])
end
def new
page = Page.new
name => "Default");
@subjects = Subject.order('position ASC');
@page_count = Page.count + 1
end
def create
page = Page.new(page_params);
if @page.save
flash[:notice] ="Page save successfuly.";
redirect_to
action => 'index');
else
@subjects = Subject.order('position ASC');
@page_count = Page.count +1
render('new');
end
end
def edit
page = Page.find(params[:id])
@subjects = Subject.order('position ASC');
@page_count = Page.count
end
def update
page = Page.find(params[:id])
if @page.update_attributes(page_params)
flash[:notice] ="Page updated successfuly.";
redirect_to
action => 'show', :id => @page.id);
else
@subjects = Subject.order('position ASC');
@page_count = Page.count
render('edit');
end
end
def delete
page = Page.find(params[:id])
end
def destroy
Page.find(params[:id]).destroy
flash[:notice] ="Page destroy successfuly."
redirect_to
action =>'index');
end
private
def page_params
params.require
page).permit
subject_id, :name,
osition, :visible,
ermalink)
end
end
*************************************************************************
package texteffects;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.effect.DropShadow;
import javafx.scene.effect.PerspectiveTransform;
import javafx.scene.effect.Reflection;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class TextEffects extends Application {
Override
public void start(Stage primaryStage) {
VBox root = new VBox(5);
root.setSpacing(20);
// Text p = new Text("Linkedin");
// Text r = new Text("Reflection in JavaFX...");
// Text d = new Text("Drop Shadow");
root.getChildren().addAll(perspective(), dropShadow(), reflection());
Scene scene = new Scene(root, 400, 400);
primaryStage.setTitle("Text Effects");
primaryStage.setScene(scene);
primaryStage.show();
}
static Node dropShadow() {
Text t = new Text();
t.setCache(true);
t.setFill(Color.FIREBRICK);
t.setText("DropShadow effect");
t.setFont(Font.font("null", FontWeight.BOLD, 32));
DropShadow ds=new DropShadow();
ds.setOffsetX(3.0);
ds.setOffsetY(3.0);
ds.setColor(Color.GRAY);
t.setEffect(ds);
return t;
}
static Node reflection() {
Text t = new Text();
t.setCache(true);
t.setText("Reflection in JavaFX...");
t.setFill(Color.CORNFLOWERBLUE);
t.setFont(Font.font("null", FontWeight.BOLD, 30));
Reflection r = new Reflection();
r.setFraction(0.9);
t.setEffect(r);
t.setTranslateY(50);
return t;
}
static Node perspective(){
Group g = new Group();
PerspectiveTransform pt = new PerspectiveTransform();
pt.setUlx(10.0f);
pt.setUly(10.0f);
pt.setUrx(210.0f);
pt.setUry(40.0f);
pt.setLrx(210.0f);
pt.setLry(60.0f);
pt.setLlx(10.0f);
pt.setLly(90.0f);
g.setEffect(pt);
g.setCache(true);
Rectangle r = new Rectangle();
r.setX(10.0f);
r.setY(10.0f);
r.setWidth(280.0f);
r.setHeight(80.0f);
r.setFill(Color.DODGERBLUE);
Text t = new Text();
t.setX(20.0f);
t.setY(65.0f);
t.setText("Linkedin");
t.setFill(Color.WHITE);
t.setFont(Font.font("null", FontWeight.BOLD, 36));
g.getChildren().addAll(r,t);
return g;
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
**************************************************
class Controller_Users extends Controller_Template
{
public function action_login()
{
$data["subnav"] = array('login'=> 'active' );
$auth = Auth::instance();
$view = View::forge('users/login', $data);
$form = Form::forge('login');
$form->add('username', 'Username:');
$form->add('password', 'Password:', array('type' => 'password'));
$form->add('submit', ' ', array('type' => 'submit', 'value' => 'Login'));
if (Input:
ost())
{
if ($auth->login(Input:
ost('username'), Input:
ost('password')))
{
Session::set_flash('success', 'Successfully logged in! Welcome '.$auth->get_screen_name());
Response::redirect('messages/');
}
else
{
Session::set_flash('error', 'Username or password incorrect.');
}
}
$view->set('form', $form, false);
$this->template->title = 'Users » Login';
$this->template->content = $view;
}
public function action_logout()
{
$auth = Auth::instance();
$auth->logout();
Session::set_flash('success', 'Logged out.');
Response::redirect('messages/');
}
public function get_register($fieldset = null, $errors = null){
$data["subnav"] = array('register'=> 'active' );
$auth = Auth::instance();
$view =View::forge('users/register', $data);
if( empty($fieldset) ){
$fieldset = Fieldset::forge('register');
Model_User:
opulate_register_fieldset($fieldset);
}
$view->set('reg', $fieldset->build(), false);
if($errors) $view->set_safe('errors',$errors);
$this->template->title ='Users $raquo; Register';
$this->template->content = $view;
}
public function post_register(){
$fieldset = Model_User::register_register_fieldset(Fieldset::forge('register'));
$fieldset->repopulate();
$result = Model_User::validate_registration($fieldset, Auth::instance());
if ($result['e_found'])
{
return $this->get_register($fieldset, $result['errors']);
}
Session::set_flash('success', 'User created.');
Response::redirect('./');
}
/*
public function action_register()
{
$data["subnav"] = array('register'=> 'active' );
$this->template->title = 'Users » Register';
$this->template->content = View::forge('users/register', $data);
}
*/
}
******************************************************************
Ito tutorial para ikaw na gumawa ng assignment mo sa susunod.
You do not have permission to view the full content of this post.
Log in or register now.