stocked
Daniel Asher Resnick 2 years ago
parent e6d89e11a7
commit ffd5dc4d77
  1. 1
      Gemfile
  2. 2
      Gemfile.lock
  3. 11
      src/app.rb
  4. 11
      src/public/css/stocked.css
  5. 2008
      src/public/js/stocked.js
  6. 1796
      src/public/js/stocked/test/data-archive.js
  7. 23
      src/public/js/stocked/test/data_1.json
  8. 54
      src/views/partials/stocked.erb

@ -5,6 +5,7 @@ gem 'sinatra'
gem 'sinatra-contrib'
gem 'prawn', '2.2.2'
gem 'prawn-templates', '0.1.1'
gem 'rubyzip'
group :development do
gem 'rerun'

@ -37,6 +37,7 @@ GEM
listen (~> 3.0)
ruby-rc4 (0.1.5)
ruby_dep (1.5.0)
rubyzip (2.3.2)
sinatra (2.0.5)
mustermann (~> 1.0)
rack (~> 2.0)
@ -63,6 +64,7 @@ DEPENDENCIES
prawn (= 2.2.2)
prawn-templates (= 0.1.1)
rerun
rubyzip
sinatra
sinatra-contrib
thin

@ -123,6 +123,17 @@ post '/wiki' do
"/get_file?file=#{key}&download_name=#{data['name']} Character Sheet.wiki"
end
post '/stocked_download' do
request.body.rewind
raw = request.body.readpartial(16 * 1024)
puts raw
data = JSON.parse(raw)
key = "stock-#{Time.now.strftime('%Y%m%d%H%M%S%L')}-#{rand(1...10000)}"
CACHE.store key, data
"/get_file?file=#{key}&download_name=#{data['Name']}.stock"
end
get '/get_file' do
data = nil
if params['download_name'].match(/\.pdf$/)

@ -48,9 +48,10 @@ div.skill-even {
div.skill-odd {
background: #F5F5F5;
}
div.trait-even {
tr.trait-even {
background: lightgray;
}
div.trait-odd {
tr.trait-odd {
background: #F5F5F5;
}
textarea.trait-desc {
@ -58,3 +59,9 @@ textarea.trait-desc {
width: 98%;
margin: 1em;
}
table.traits{
width: 100%;
}
table.traits input.editable-name {
width: 100%;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,23 @@
{
"Foo Setting": {
"Born Foo": {
"time": 1,
"res": 5,
"stat": [
[1, "pm"]
],
"leads": [
"Bar"
],
"key_leads": [
"Bar Setting"
],
"skills": [
[3, "General"]
],
"traits": [1],
"common_traits": []
}
},
"Bar Setting": {}
}

@ -29,13 +29,14 @@
<div class='container'>
<div class='row'>
<div class='col-md-3'>
<a href='' ng-click='stocked_uploadCharredModel()'>
TODO: Upload charred model
<input type="file" id="stocked_charred_file"/>
<a href='' ng-click='stocked_loadCharredModel()'>
TODO: Load charred stock model
</a>
</div>
<div class='col-md-3'>
<a href='' ng-click='stocked_downloadCharredModel()'>
TODO: Download charred model
TODO: Download charred stock model
</a>
</div>
<div class='col-md-3'>
@ -113,6 +114,13 @@
<div class='panel-body'>
<div class="panel">
<div class="panel-body">
<span class="note-label">Note:</span>
<span class="note-content">
Prefix a lifepath's name with "Born " to have charred consider it a born lifepath;
i.e. selectable if and only if it is the first lifepath.
</span>
<br />
<a ng-click='collapseBody(".collapse_all_"+to_id(setting.name), $event)' href=''>
collapse/expand all paths in setting
</a>
@ -329,36 +337,40 @@
</div>
<div class='panel-collapse collapse in' id='collapse_traits'>
<div class='panel-body'>
<div class='container-fluid'>
<div class='row'>
<div class='h4 col-md-3'>Trait</div>
<div class='h4 col-md-1'>Cost</div>
<div class='h4 col-md-2'>Type</div>
<table class="traits">
<tr>
<th>Trait</th>
<th>Cost</th>
<th>Type</th>
<%# <div class='h4 col-md-2'>Bonus</div> %>
<%# <div class='h4 col-md-2'>Restrictions</div> %>
</div>
</div>
<div ng-repeat='trait in traits' ng-class-even="'trait-even'" ng-class-odd="'trait-odd'">
<div class='row'>
<div class='h4 col-md-3'>
</tr>
<%# </div> %>
<tr ng-repeat-start='trait in traits' ng-class-even="'trait-even'" ng-class-odd="'trait-odd'">
<td>
<input ng-model="trait.name"
class='form-control input-lg not-editing editable-name'
ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
</div>
<div class='h4 col-md-1'>
</td>
<td>
<input type="number" class='not-editing editable-num'
ng-model="trait.cost" ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
</div>
<div class='h4 col-md-2'>
</td>
<td>
<select class='form-control' ng-model='trait.type' ng-options='t for t in TRAIT_TYPES'></select>
</div>
</div>
</td>
<td><a href='' ng-click='removeTrait($index)'>[X]</a></td>
</tr>
<%# <div class='h4 col-md-2'>WISHLIST</div> %>
<%# <div class='h4 col-md-2'>WISHLIST</div> %>
<div>
<textarea class='trait-desc' ng-model='trait.desc'></textarea>
<tr ng-repeat-end ng-class-even="'trait-even'" ng-class-odd="'trait-odd'">
<td colspan="99"><textarea class='trait-desc' ng-model='trait.desc'></textarea></td>
</tr>
</table>
<div class='row'>
<div class='h4 col-md-12'><a href='' ng-click='addTrait()'>Add new trait</a></div>
</div>
</div>
</div>

Loading…
Cancel
Save