Removed WSF_STATELESS_MULTI_CONTROL

This commit is contained in:
Severin Münger
2013-09-24 15:02:33 +02:00
parent c52a513378
commit f51201eae1
5 changed files with 31 additions and 85 deletions

View File

@@ -22,7 +22,7 @@ feature
do do
create control.make_multi_control ("container") create control.make_multi_control ("container")
control.add_class ("container") control.add_class ("container")
create navbar.make_navbar_with_brand ("Example") create navbar.make_navbar_with_brand ("navbar1", "Example")
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/%"", "Home")) navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/%"", "Home"))
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/grid%"", "Grid")) navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/grid%"", "Grid"))
navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/repeater%"", "Repeater")) navbar.add_list_element (create {WSF_BASIC_CONTROL}.make_with_body ("a", "href=%"/repeater%"", "Repeater"))

View File

@@ -34,6 +34,6 @@ feature -- Implementation
feature -- Properties feature -- Properties
slider: WSF_IMAGE_SLIDER_CONTROL slider: WSF_SLIDER_CONTROL
end end

View File

@@ -9,30 +9,29 @@ class
inherit inherit
WSF_STATELESS_MULTI_CONTROL WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
redefine redefine
render render
end end
create create
make_navbar, make_navbar, make_navbar_with_brand
make_navbar_with_brand
feature {NONE} -- Initialization feature {NONE} -- Initialization
make_navbar make_navbar (n: STRING)
--Initialize --Initialize
do do
make_multi_control make_multi_control (n)
add_class ("navbar navbar-inverse navbar-fixed-top") add_class ("navbar navbar-inverse navbar-fixed-top")
create nav.make_with_tag_name ("ul") create nav.make_with_tag_name (control_name + "_nav", "ul")
nav.add_class ("nav navbar-nav") nav.add_class ("nav navbar-nav")
end end
make_navbar_with_brand (b: STRING) make_navbar_with_brand (n, b: STRING)
-- Initialize with specified brand string -- Initialize with specified brand string
do do
make_navbar make_navbar (n)
brand := b brand := b
end end
@@ -65,10 +64,16 @@ feature -- Change
add_list_element_right (c: WSF_STATELESS_CONTROL) add_list_element_right (c: WSF_STATELESS_CONTROL)
-- Add element in li tag to right aligned part of navbar -- Add element in li tag to right aligned part of navbar
local local
right: WSF_STATELESS_MULTI_CONTROL name: STRING
li: WSF_STATELESS_MULTI_CONTROL li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do do
create li.make_with_tag_name ("li") name := control_name + "_rightlink";
if attached nav_right as right then
name := name + right.controls.count.out
else
name := name + "0"
end
create li.make_with_tag_name (name, "li")
li.add_control (c) li.add_control (c)
add_element_right (li) add_element_right (li)
end end
@@ -76,9 +81,9 @@ feature -- Change
add_list_element (c: WSF_STATELESS_CONTROL) add_list_element (c: WSF_STATELESS_CONTROL)
-- Add element in li tag to main nav -- Add element in li tag to main nav
local local
li: WSF_STATELESS_MULTI_CONTROL li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do do
create li.make_with_tag_name ("li") create li.make_with_tag_name (control_name + "_link" + nav.controls.count.out, "li")
li.add_control (c) li.add_control (c)
add_element (li) add_element (li)
end end
@@ -86,12 +91,12 @@ feature -- Change
add_element_right (c: WSF_STATELESS_CONTROL) add_element_right (c: WSF_STATELESS_CONTROL)
-- Add element to right aligned part of navbar -- Add element to right aligned part of navbar
local local
right: WSF_STATELESS_MULTI_CONTROL right: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do do
if attached nav_right as r then if attached nav_right as r then
right := r right := r
else else
create right.make_with_tag_name ("ul") create right.make_with_tag_name (control_name + "_rightnav", "ul")
right.add_class ("nav navbar-nav navbar-right") right.add_class ("nav navbar-nav navbar-right")
nav_right := right nav_right := right
end end
@@ -109,10 +114,10 @@ feature -- Properties
brand: detachable STRING brand: detachable STRING
-- Optional brand of the navbar -- Optional brand of the navbar
nav: WSF_STATELESS_MULTI_CONTROL nav: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
-- Middle nav -- Middle nav
nav_right: detachable WSF_STATELESS_MULTI_CONTROL nav_right: detachable WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
-- Right nav -- Right nav
end end

View File

@@ -1,59 +0,0 @@
note
description: "Summary description for {WSF_STATELESS_MULTI_CONTROL}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_STATELESS_MULTI_CONTROL
inherit
WSF_STATELESS_CONTROL
create
make_multi_control, make_with_tag_name
feature {NONE} -- Initialization
make_multi_control
-- Initialize with default tag "div"
do
make_with_tag_name ("div")
end
make_with_tag_name (t: STRING)
-- Initialize with specified tag
do
make (t)
controls := create {ARRAYED_LIST [WSF_STATELESS_CONTROL]}.make (5);
end
feature -- Rendering
render: STRING
-- HTML representation of this stateless multi control
do
Result := ""
across
controls as c
loop
Result := c.item.render + Result
end
Result := render_tag (Result, "")
end
feature -- Change
add_control (c: WSF_STATELESS_CONTROL)
-- Add control to this stateless multi control
do
controls.put_front (c)
end
feature -- Properties
controls: ARRAYED_LIST [WSF_STATELESS_CONTROL]
-- List of controls
end

View File

@@ -21,9 +21,9 @@ feature {NONE} -- Initialization
do do
make_control (n, "div") make_control (n, "div")
add_class ("carousel slide") add_class ("carousel slide")
create list.make_with_tag_name ("ol") create list.make_with_tag_name (control_name+"_links", "ol")
list.add_class ("carousel-indicators") list.add_class ("carousel-indicators")
create slide_wrapper.make_multi_control create slide_wrapper.make_multi_control (control_name+"_wrapper")
slide_wrapper.add_class ("carousel-inner") slide_wrapper.add_class ("carousel-inner")
end end
@@ -63,10 +63,10 @@ feature -- Change
add_image_with_caption (src, alt: STRING; caption: detachable WSF_STATELESS_CONTROL) add_image_with_caption (src, alt: STRING; caption: detachable WSF_STATELESS_CONTROL)
-- Add a new image to the slider, with specified url, alternative text and caption element -- Add a new image to the slider, with specified url, alternative text and caption element
local local
item: WSF_STATELESS_MULTI_CONTROL item: WSF_MULTI_CONTROL[WSF_STATELESS_CONTROL]
do do
list.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("li", "data-target=%"#" + control_name + "%" data-slide-to=%"" + list.controls.count.out + "%"", "")); list.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("li", "data-target=%"#" + control_name + "%" data-slide-to=%"" + list.controls.count.out + "%"", ""));
create item.make_multi_control create item.make_multi_control (control_name+"_item"+slide_wrapper.controls.count.out)
item.add_class ("item") item.add_class ("item")
item.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("img", "src=%"" + src + "%" alt=%"" + alt + "%"", "")) item.add_control (create {WSF_BASIC_CONTROL}.make_with_body ("img", "src=%"" + src + "%" alt=%"" + alt + "%"", ""))
if attached caption as c then if attached caption as c then
@@ -88,10 +88,10 @@ feature -- Change
feature -- Properties feature -- Properties
list: WSF_STATELESS_MULTI_CONTROL list: WSF_MULTI_CONTROL[WSF_STATELESS_CONTROL]
-- List of slider links -- List of slider links
slide_wrapper: WSF_STATELESS_MULTI_CONTROL slide_wrapper: WSF_MULTI_CONTROL[WSF_STATELESS_CONTROL]
-- List of the single slides -- List of the single slides
end end