Commit e52a9b4979972cfd9e7db71e96e08af0757e0d69
1 parent
bccbb818
Exists in
master
and in
29 other branches
ActionItem305: importing menus
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
script/import-cooperation.net
... | ... | @@ -116,6 +116,21 @@ for username in ARGV |
116 | 116 | |
117 | 117 | end |
118 | 118 | end |
119 | + | |
120 | + # import menus | |
121 | + for i in [1,2] | |
122 | + links = [] | |
123 | + data = Hash.from_xml(File.read(File.join(IMPORT_DIR, username, "menu#{i}.xml"))) | |
124 | + data['menu']['items'].each do |item| | |
125 | + links << { :name => item['title'], :address => item['url'] } | |
126 | + end | |
127 | + block = person.blocks.select { |block| block.class == LinkListBlock }[i-1] | |
128 | + block.title = data['menu']['title'] | |
129 | + block.links = links | |
130 | + block.save! | |
131 | + puts "imported links: #{links.inspect}" | |
132 | + end | |
133 | + | |
119 | 134 | end |
120 | 135 | rescue Exception => e |
121 | 136 | $stderr.puts "==================================" | ... | ... |