Skip to content

Commit

Permalink
Upgrade to SL2 Beta2
Browse files Browse the repository at this point in the history
- Still has a bunch of problems (Hash, stack traces, File.open)
  • Loading branch information
jschementi committed May 12, 2008
1 parent f51abc5 commit 4eaa9b0
Show file tree
Hide file tree
Showing 107 changed files with 386 additions and 332 deletions.
10 changes: 8 additions & 2 deletions .eprj 100755 → 100644
Expand Up @@ -4,14 +4,20 @@
<dict>
<key>fileTriggers</key>
<dict>
<key>_posts.rb</key>
<string>app\views\posts\_posts.rb</string>
<key>app.rb</key>
<string>C:\Users\jimmysch\Projects\vsl\Merlin\Users\jimmysch\dynamic_silverlight\photoviewer\ruby\app.rb</string>
<string>..\vsl\Merlin\Users\jimmysch\dynamic_silverlight\photoviewer\ruby\app.rb</string>
<key>generator.rb</key>
<string>vendor\plugins\silverline\lib\silverline\essential\generator.rb</string>
<key>index.</key>
<string>app\views\posts\index.html.erb</string>
<key>index.h</key>
<string>app\client\views\posts\index.erb.html</string>
<key>silverli</key>
<string>C:\Users\jimmysch\Projects\vsl\Merlin\Users\jimmysch\dynamic_silverlight\photoviewer\ruby\silverlight.rb</string>
<string>..\vsl\Merlin\Users\jimmysch\dynamic_silverlight\photoviewer\ruby\silverlight.rb</string>
<key>xap.rb</key>
<string>vendor\plugins\silverline\lib\silverline\essential\xap.rb</string>
</dict>
</dict>
</plist>
Empty file modified README 100755 → 100644
Empty file.
Empty file modified app/controllers/application.rb 100644 → 100755
Empty file.
Empty file modified app/controllers/render_test_controller.rb 100644 → 100755
Empty file.
Empty file modified app/helpers/posts_helper.rb 100644 → 100755
Empty file.
Empty file modified app/helpers/render_test_helper.rb 100644 → 100755
Empty file.
Empty file modified app/models/post.rb 100644 → 100755
Empty file.
Empty file modified app/views/layouts/.DS_Store 100644 → 100755
Empty file.
Empty file modified app/views/layouts/posts.html.erb 100644 → 100755
Empty file.
Empty file modified app/views/layouts/render_test.html.erb 100644 → 100755
Empty file.
8 changes: 6 additions & 2 deletions app/views/posts/_posts.html.erb 100644 → 100755
@@ -1,3 +1,6 @@
<% if @posts.empty? %>
No posts, add one below!
<% else %>
<table>
<tr>
<% @posts.first.keys.each do |key| %>
Expand All @@ -7,8 +10,9 @@
<% @posts.each do |post| %>
<tr>
<% post.keys.each do |key| %>
<td><%= post[key] %></td>"
<td><%= post[key] %></td>
<% end %>
</tr>
<% end %>
</table>
</table>
<% end %>
33 changes: 4 additions & 29 deletions app/views/posts/_posts.rb 100644 → 100755
@@ -1,35 +1,10 @@
require 'silverlight'

class Posts < SilverlightApplication
def initialize
super
result = download "/posts.json"
@posts = result.empty? ? [] : JSON.new.parse(result)
render_posts :id => "posts"
end

def render_posts(options = {})
id, posts = options[:id], @posts
if @posts.empty?
output = "No posts! Add one below!"
else
output = "<table>"
output += " <tr>"
posts.first.keys.each do |key|
output += " <th>#{key}</th>"
end
output += " </tr>"
posts.each do |post|
output += " <tr>"
post.keys.each do |key|
output += " <td>#{post[key]}</td>"
end
output += " </tr>"
end
output += "</table>"
end
document.send(id)[:innerHTML] = output
def start
@posts = get "posts", :format => 'ruby'
render :partial => "posts/posts", :update => "posts"
end
end

Posts.new
Posts.new.start
Empty file modified app/views/posts/edit.html.erb 100644 → 100755
Empty file.
Empty file modified app/views/posts/new.html.erb 100644 → 100755
Empty file.
Empty file modified app/views/posts/show.html.erb 100644 → 100755
Empty file.
Empty file modified app/views/render_test/test_xaml.html.erb 100644 → 100755
Empty file.
Empty file modified public/.htaccess 100644 → 100755
Empty file.
Empty file modified public/404.html 100644 → 100755
Empty file.
Empty file modified public/422.html 100644 → 100755
Empty file.
Empty file modified public/500.html 100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions public/clientaccesspolicy.xml 100644 → 100755
Expand Up @@ -2,10 +2,10 @@
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<allow-from>
<domain uri="*"/>
</allow-from>
<grant-to>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
Expand Down
Empty file modified public/favicon.ico 100644 → 100755
Empty file.
Empty file modified public/images/loading.gif 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/rails.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/index.html 100644 → 100755
Empty file.
Binary file modified public/ironruby/Chiron.exe 100644 → 100755
Binary file not shown.
8 changes: 3 additions & 5 deletions public/ironruby/Chiron.exe.config 100644 → 100755
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="Languages" type="Chiron.LanguageSection, Chiron"/>
Expand All @@ -19,7 +19,7 @@
<add key="urlPrefix" value="http://example.com/assemblies/" />
-->

<add key="urlPrefix" value="http://localhost:3000/ironruby" />
<add key="urlPrefix" value="/ironruby" />

<!-- the location of language assemblies on disk -->
<add key="localAssemblyPath" value="." />
Expand All @@ -33,9 +33,7 @@
-->
<Languages>

<Language extensions="py" assemblies="IronPython.dll, IronPython.Modules.dll" />
<Language extensions="rb" assemblies="IronRuby.dll, IronRuby.Libraries.dll" />
<Language extensions="js, jsx" assemblies="Microsoft.JScript.Runtime.dll, Microsoft.JScript.Compiler.dll" />

<!--
Example language entry. The languageContext attribute must point at the
Expand All @@ -60,7 +58,7 @@
<AppManifest.xaml>
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RuntimeVersion="2.0.30226.00"
RuntimeVersion="2.0.30523.00"
EntryPointAssembly="Microsoft.Scripting.Silverlight"
EntryPointType="Microsoft.Scripting.Silverlight.DynamicApplication">

Expand Down
Binary file removed public/ironruby/IronPython.Modules.dll
Binary file not shown.
Binary file removed public/ironruby/IronPython.dll
Binary file not shown.
Binary file modified public/ironruby/IronRuby.Libraries.dll 100644 → 100755
Binary file not shown.
Binary file modified public/ironruby/IronRuby.dll 100644 → 100755
Binary file not shown.
Binary file added public/ironruby/Microsoft.Scripting.Core.dll
Binary file not shown.
Binary file modified public/ironruby/Microsoft.Scripting.Silverlight.dll 100644 → 100755
Binary file not shown.
Binary file modified public/ironruby/Microsoft.Scripting.dll 100644 → 100755
Binary file not shown.
Empty file modified public/javascripts/application.js 100644 → 100755
Empty file.
Empty file modified public/javascripts/controls.js 100644 → 100755
Empty file.
Empty file modified public/javascripts/dragdrop.js 100644 → 100755
Empty file.
Empty file modified public/javascripts/effects.js 100644 → 100755
Empty file.
Empty file modified public/javascripts/prototype.js 100644 → 100755
Empty file.
Empty file modified public/robots.txt 100644 → 100755
Empty file.
Empty file modified public/stylesheets/.DS_Store 100644 → 100755
Empty file.
Empty file modified public/stylesheets/error.css 100644 → 100755
Empty file.
Empty file modified public/stylesheets/scaffold.css 100644 → 100755
Empty file.
Empty file modified vendor/plugins/silverline/MIT-LICENSE 100644 → 100755
Empty file.
Empty file modified vendor/plugins/silverline/README 100644 → 100755
Empty file.
Empty file modified vendor/plugins/silverline/Rakefile 100644 → 100755
Empty file.
Binary file removed vendor/plugins/silverline/client/.DS_Store
Binary file not shown.
Empty file modified vendor/plugins/silverline/client/app_render_xaml.rb 100644 → 100755
Empty file.
12 changes: 9 additions & 3 deletions vendor/plugins/silverline/client/app_teleport.rb
Expand Up @@ -21,15 +21,21 @@ def initialize
private

def find_client_links
titles = @client_links.collect { |l| l['title'] }
document.get_elements_by_tag_name("a").select {
|a| titles.include?(a[:title]) && a[:rel] == "silverlight".to_clr_string
$app.puts params[:client_links]
$app.puts @client_links.inspect
titles = @client_links.collect { |l| puts l.keys.inspect; l.fetch("title") }
$app.puts titles.inspect
document.get_elements_by_tag_name("a").select {
|a| titles.include?(a.title) && a.rel == "silverlight".to_clr_string
}
end

def hook_client_link(a)
$app.puts "hooking stuff"
link = @client_links.select{ |l| l['title'] == a[:title] }.first
$app.puts "hooking stuff"
unless link.nil?
$app.puts "hooking stuff"
a.onclick { |s, e| do_action(link['options']) }
a.remove_attribute("title")
end
Expand Down
Binary file removed vendor/plugins/silverline/client/lib/.DS_Store
Binary file not shown.
60 changes: 20 additions & 40 deletions vendor/plugins/silverline/client/lib/application.rb 100644 → 100755
@@ -1,45 +1,15 @@
require 'lib/patch'
require 'lib/helpers'
require 'lib/rails'

include System::Windows
include System::Windows::Browser

class SilverlightApplication
include Downloader
#include Debug
# TODO: remove these methods when "extend" is implemented
def self.puts(msg)
if document.debug_print.nil?
div = document.create_element('div')
div[:id] = "debug_print"
document.get_elements_by_tag_name("body").get_Item(0).append_child(div)
end
document.debug_print[:innerHTML] = "#{document.debug_print.innerHTML}<hr />#{msg}"
end
def puts(msg)
self.class.puts(msg)
end
def self.debug_puts(msg)
puts(msg) if $DEBUG
end
def debug_puts(msg)
self.class.debug_puts(msg)
end

include Html
# TODO: remove these method when "extend" is added
def self.document
HtmlPage.document
end

include Wpf
# TODO: remove this method when "extend" is implemented
def self.use_xaml(options = {})
options = {:type => UserControl, :name => "app"}.merge(options)
type = options[:type].new
Application.load_component(type, Uri.new("#{options[:name]}.xaml", UriKind.Relative))
Application.current.root_visual = type
end
include Debug

attr_reader :params

Expand All @@ -53,18 +23,28 @@ def application
end

def method_missing(m)
element = root.send(m)
element = document.send(m) if element.nil?
return element
super
rescue => e
begin
return element = root.send(m)
rescue
begin
return element = document.send(m)
rescue
raise e
end
end
end

def dejsonify(o)
JSON.new.parse(o.replace("==>", ",").replace("'", "\""))
end

#def render(options = {})
# file = File.open("views/#{options[:view]}.erb.html", 'r')
# rhtml = ERB.new file.read
# document.send(options[:id])[:innerHTML] = rhtml.run(binding)
#end
def render(options = {})
split_url = options[:partial].split "/"
split_url[-1] = "_#{split_url[-1]}"
partial = split_url.join "/"
rhtml = ERB.new XAP.get_file_contents("views/#{partial}.html.erb")
document.send(options[:update])[:innerHTML] = rhtml.result(binding)
end
end
3 changes: 2 additions & 1 deletion vendor/plugins/silverline/client/lib/helpers.rb 100644 → 100755
Expand Up @@ -2,4 +2,5 @@
require 'lib/helpers/downloader'
require 'lib/helpers/html'
require 'lib/helpers/wpf'
require 'lib/helpers/json'
require 'lib/helpers/json_beta1'
require 'lib/helpers/xap'
41 changes: 26 additions & 15 deletions vendor/plugins/silverline/client/lib/helpers/debug.rb 100644 → 100755
@@ -1,20 +1,31 @@
module Debug
def self.puts(msg)
if document.debug_print.nil?
div = document.create_element('div')
div[:id] = "debug_print"
document.get_elements_by_tag_name("body").get_Item(0).append_child(div)
end
document.debug_print[:innerHTML] = "#{document.debug_print.innerHTML}<hr />#{msg}"
def self.included(base)
base.extend(ClassMethods)
base.include(InstanceMethods)
end
def puts(msg)
self.class.puts(msg)

module ClassMethods
def puts(msg)
if document.debug_print.nil?
div = document.create_element('div')
div[:id] = "debug_print"
document.get_elements_by_tag_name("body").get_Item(0).append_child(div)
end
document.debug_print[:innerHTML] = "#{document.debug_print.innerHTML}<hr />#{msg}"
end

def debug_puts(msg)
self.puts(msg) if $DEBUG
end
end

def self.debug_puts(msg)
puts(msg) if $DEBUG
end
def debug_puts(msg)
self.class.debug_puts(msg)

module InstanceMethods
def puts(msg)
self.class.puts(msg)
end

def debug_puts(msg)
self.class.debug_puts(msg)
end
end
end
6 changes: 6 additions & 0 deletions vendor/plugins/silverline/client/lib/helpers/downloader.rb 100644 → 100755
Expand Up @@ -15,4 +15,10 @@ def download(url, &block)
end
end

def get(url, options, &block)
json = download "/#{url}.json"
return JSON.new.parse(json) if options[:format] == 'ruby'
return json
end

end
3 changes: 1 addition & 2 deletions vendor/plugins/silverline/client/lib/helpers/html.rb 100644 → 100755
Expand Up @@ -2,7 +2,6 @@
include System::Windows::Browser

module Html
=begin
def self.included(base)
base.extend(ClassMethods)
end
Expand All @@ -12,7 +11,7 @@ def document
HtmlPage.document
end
end
=end

def document
self.class.document
end
Expand Down

0 comments on commit 4eaa9b0

Please sign in to comment.